mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-05 16:37:43 +00:00
ec114808b2
Implement new hook that synchronizes user language and timezone preferences from frontend to backend. Ensures consistent localization across and notifications. Note: Current implementation works but auth code requires future refactoring.
16 lines
430 B
TypeScript
16 lines
430 B
TypeScript
import { type ApiUser } from './ApiUser'
|
|
import { fetchApi } from '@/api/fetchApi'
|
|
|
|
export type ApiUserPreferences = Pick<ApiUser, 'id' | 'timezone' | 'language'>
|
|
|
|
export const updateUserPreferences = async ({
|
|
user,
|
|
}: {
|
|
user: ApiUserPreferences
|
|
}): Promise<ApiUser> => {
|
|
return await fetchApi(`/users/${user.id}/`, {
|
|
method: 'PUT',
|
|
body: JSON.stringify({ timezone: user.timezone, language: user.language }),
|
|
})
|
|
}
|