feat(web): send timezone on login + bootstrap + weekly
Web client posts Intl.DateTimeFormat().resolvedOptions().timeZone to PUT /api/me/timezone after every successful login, register, and bootstrap when the locally-stored tz_last_sent_at is >7 days old. Cadence tracked in localStorage keeps the server stateless on the "is this stale?" check. Failures swallowed: the server's UTC default + last-known value keep the scheduler functioning until the next successful attempt. SSR- safe via the typeof window guard. For #392 Half B. Companion Flutter change in next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,3 +53,12 @@ export async function getAPIToken(): Promise<APITokenResponse> {
|
||||
export async function regenerateAPIToken(): Promise<APITokenResponse> {
|
||||
return api.post<APITokenResponse>('/api/me/api-token', {});
|
||||
}
|
||||
|
||||
// Submits the browser's current IANA timezone for the authenticated
|
||||
// user. Called from the auth store on login + bootstrap + once weekly
|
||||
// (cadence tracked client-side in localStorage). Failures are
|
||||
// non-fatal — the server's UTC fallback keeps the scheduler working
|
||||
// until the next attempt.
|
||||
export async function putMyTimezone(timezone: string): Promise<void> {
|
||||
await api.put<void>('/api/me/timezone', { timezone });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user