User Account
Profile data, preferences, sessions, and account lifecycle in the Expo template.
Account profile
The Account profile loads the current user from /api/v1/app/me after restoring a Sanctum token. The shared User type includes:
id,uuid,name, andemail.role,is_verified, andhas_password.avatar_urlandphone_number.created_atandupdated_at.
Guest projects do not create or restore a remote user. The Guest runtime clears stale Account tokens and uses local onboarding/profile state instead.
Editing the profile
Profile updates use useUpdateProfileMutation and the PUT /api/v1/app/users/{uuid} contract. The API client maps Laravel validation errors into the mutation error state. Avatar uploads use the Laravel-owned /uploads endpoint and require the Account backend.
const mutation = useUpdateProfileMutation();
await mutation.mutateAsync({
name: 'Ada Lovelace',
phone_number: '+1 555 0100',
});Use the generated form and mutation types rather than constructing a second request client.
Preferences
The preferences store persists language, region, timezone, data-sharing choices, notification settings, and onboarding completion locally. In Account mode, changes are debounced and synchronized to:
PUT /api/v1/app/preferencesPUT /api/v1/app/notifications/preferences
Failed writes are marked pending and retried after authentication. In Guest mode, preferences remain local-only and are never queued for remote sync.
Security and account deletion
The security screens expose:
- Active sessions with per-session revoke and revoke-all actions.
- Login history.
- Password change.
- Account deletion with local auth cleanup after success.
These are Account-only operations. Laravel owns destructive security mutations; the Go service serves the protected security reads.
Token and logout behavior
Logout clears the Zustand auth state and removes the secure token. A 401 from the API performs the same cleanup and the root layout returns the user to the auth flow.
Relevant files
store/auth-store.tsstore/preferences-store.tsandstore/preferences-sync.tsqueries/use-auth.tsandqueries/use-security.tsmutations/use-update-profile-mutation.tsandmutations/use-security-mutations.tsservices/storage.ts
