diff --git a/apps/portal/src/app/features/profile/components/AddressFormContent.tsx b/apps/portal/src/app/features/profile/components/AddressFormContent.tsx index a07c8aa49..33f5cd4ff 100644 --- a/apps/portal/src/app/features/profile/components/AddressFormContent.tsx +++ b/apps/portal/src/app/features/profile/components/AddressFormContent.tsx @@ -31,10 +31,13 @@ export const addressSchema = z.object({ export type AddressValues = z.infer; +// Backend rejects anything outside this set: +// "idType must be one of the following values: NID, VITAL, PASSPORT, DRIVERS_LICENSE" export const ID_TYPES = [ - { value: 'KEBELE_ID', label: 'Kebele Id' }, - { value: 'PASSPORT', label: 'Passport' }, { value: 'NID', label: 'National Id' }, + { value: 'VITAL', label: 'Vital ID' }, + { value: 'PASSPORT', label: 'Passport' }, + { value: 'DRIVERS_LICENSE', label: "Driver's License" }, ] as const; /** diff --git a/apps/portal/src/app/features/profile/pages/ProfilePage.tsx b/apps/portal/src/app/features/profile/pages/ProfilePage.tsx index 2ac740812..fa4373973 100644 --- a/apps/portal/src/app/features/profile/pages/ProfilePage.tsx +++ b/apps/portal/src/app/features/profile/pages/ProfilePage.tsx @@ -271,7 +271,11 @@ export function ProfilePage() { const onSavePersonal = async (values: PersonalValues) => { setIsSavingProfile(true); try { - await updateTrigger({ + // The PATCH already returns the updated user — trusting it instead of + // an immediate follow-up GET avoids a read-after-write race where the + // GET can return pre-edit data and silently undo `setUser` below, + // which is why the change used to only show up after a re-login. + const updated = await updateTrigger({ url: '/auth/update-profile', method: 'PATCH', body: { @@ -282,9 +286,7 @@ export function ProfilePage() { }, }).unwrap(); - const me = await meTrigger({ url: '/auth/me', method: 'GET' }).unwrap(); - dispatch(setUser(me)); - + dispatch(setUser(updated)); notify.success(t('profile.profileUpdated')); } catch (e) { handleError(e);