diff --git a/src/hooks.client.ts b/src/hooks.client.ts index 3af4709..ffd1e9f 100644 --- a/src/hooks.client.ts +++ b/src/hooks.client.ts @@ -2,6 +2,12 @@ import { refresh_auth } from "$lib/pocketbase"; import type { ClientInit } from "@sveltejs/kit"; export const init: ClientInit = async () => { - // NOTE: If the auth token is invalidated, this will block the entire page - // await refresh_auth(); + // Try to refresh the authStore. This is required when e.g. + // changing e-mail address. The new e-mail will show up after + // being verified, so the authStore has to be reloaded. + try { + await refresh_auth(); + } catch (error) { + console.log("hooks.client.ts:", error); + } };