Skip to content

feat(profile): replace stubbed useProfileUpdate with real API call (#936) - #1125

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
omosvico:feat/profile-api-936
Jul 30, 2026
Merged

feat(profile): replace stubbed useProfileUpdate with real API call (#936)#1125
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
omosvico:feat/profile-api-936

Conversation

@omosvico

Copy link
Copy Markdown
Contributor

Closes #936

Problem: useProfileUpdate used await new Promise(r => setTimeout(r, 1000)) and returned a synthesized success response — profile edits appeared to save but persisted nothing.

Changes:

  1. New API route src/app/api/user/profile/route.ts — PUT handler with Zod validation for all profile fields, returns field-level errors on validation failure.

  2. Updated hook src/app/hooks/useProfileUpdate.ts — replaced the setTimeout stub with apiClient.put("/api/user/profile", data). The typed ProfileUpdateResponse interface includes errors?: { field: string; message: string }[] for propagation.

  3. Updated form src/app/components/profile/ProfileEditForm.tsx — catches ApiError with field errors and calls setError from react-hook-form to highlight the offending fields with server-side validation messages.

- Create PUT /api/user/profile endpoint with Zod validation
- Replace setTimeout stub in useProfileUpdate with apiClient.put call
- Propagate server-side validation errors to form fields via setError
- Hook returns typed ProfileUpdateResponse with field-level errors

Closes rinafcode#936
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@omosvico Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 7a9b03a into rinafcode:main Jul 30, 2026
6 checks passed
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.

Replace the stubbed useProfileUpdate timeout with a real API call

2 participants