We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e23f965 commit 2bed634Copy full SHA for 2bed634
src/lib/stores/user.ts
@@ -13,6 +13,10 @@ export type Account = Models.User<
13
>;
14
15
export const user = derived(page, ($page) => {
16
- if (browser) sessionStorage.setItem('account', JSON.stringify($page.data.account));
17
- return $page.data.account as Account;
+ if ($page.data?.account) {
+ if (browser) {
18
+ sessionStorage.setItem('account', JSON.stringify($page.data.account));
19
+ }
20
+ return $page.data.account as Account;
21
+ } else return null;
22
});
0 commit comments