Backend: new UpdateUserProfileUseCase with email uniqueness validation, PUT /auth/profile endpoint. Frontend: ProfilePage with avatar initials, inline success/error feedback, and refreshUser() sync after save. Avatar dropdown in AppShell gains a "Meu Perfil" link. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
21 lines
437 B
TypeScript
21 lines
437 B
TypeScript
import { apiFetch } from '../lib/api'
|
|
|
|
export interface UpdateProfilePayload {
|
|
name: string
|
|
email: string
|
|
}
|
|
|
|
export interface UpdateProfileResult {
|
|
name: string
|
|
email: string
|
|
photo: string
|
|
}
|
|
|
|
export const userService = {
|
|
updateProfile: async (payload: UpdateProfilePayload): Promise<UpdateProfileResult> => {
|
|
return apiFetch<UpdateProfileResult>('/auth/profile', {
|
|
method: 'PUT',
|
|
body: payload,
|
|
})
|
|
},
|
|
}
|