Skip to content

Conversation

@Lance-Yuriel
Copy link

📝 Description

This PR implements the client-side HTTP requests for workout session API functions in src/shared/lib/workout-session/workout-session.api.ts. The functions were previously returning empty arrays or placeholder values instead of making actual requests to the server.

Key Changes:

  • getAll() - Implemented GET requests to /api/workout-sessions to fetch all workout sessions
  • create() - Implemented POST requests to /api/workout-sessions to create new workout sessions
  • update() - Implemented PATCH requests to /api/workout-sessions/:id to update existing sessions
  • complete() - Implemented PATCH requests to /api/workout-sessions/:id/complete to mark sessions as completed

Integration & Architecture:

  • Integrated all API functions into useWorkoutSessionService with proper fallbacks to server actions
  • Added direct API calls to workout-session.store.ts for workout completion flow
  • Maintained backward compatibility with existing server action patterns
  • Added comprehensive error handling with graceful fallbacks

Testing & Verification:

  • All 4 API functions tested and working with real network calls
  • Verified proper HTTP requests in browser dev tools (GET, POST, PATCH)
  • Confirmed error handling and fallback mechanisms work correctly
  • Tested complete workout flow end-to-end

📋 Checklist

  • My code follows the project conventions
  • This PR includes breaking changes
  • I have updated documentation if necessary

🗃️ Prisma Migrations (if applicable)

  • I have created a migration
  • I have tested the migration locally

📸 Screenshots (if applicable)

Network Tab Evidence:

  • Console logs show successful API calls: 🔄 Attempting to complete workout via API and ✅ Workout completed via API
  • Network tab shows proper HTTP requests initiated by workout-session.api.ts
  • Terminal logs confirm server responses: PATCH /api/workout-sessions/1759890128120/complete 200 in 1680ms

🔗 Related Issues

Resolves: Client-side API implementation for workout sessions

- Implement getAll() using GET /api/workout-sessions
- Implement create() using POST /api/workout-sessions
- Implement update() using PATCH /api/workout-sessions/:id
- Implement complete() using PATCH /api/workout-sessions/:id/complete
- Integrate API functions into useWorkoutSessionService
- Add direct API calls to workout-session.store.ts for complete()
- Add proper error handling with server action fallbacks
- All functions tested and working with real network calls

Resolves: Client-side API implementation for workout sessions
@vercel
Copy link

vercel bot commented Oct 16, 2025

@Lance-Yuriel is attempting to deploy a commit to the Workoutcool Team Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant