From 2b5a80a0324d153b20eac7e6949cc02aea9c1c07 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 22 Mar 2022 18:10:39 +0100 Subject: implement currentUser store --- web/pw-server/src/lib/components/navbar/UserControls.svelte | 13 +++++++------ web/pw-server/src/lib/stores/current_user.ts | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 web/pw-server/src/lib/stores/current_user.ts (limited to 'web/pw-server/src/lib') diff --git a/web/pw-server/src/lib/components/navbar/UserControls.svelte b/web/pw-server/src/lib/components/navbar/UserControls.svelte index e9dbab1..3c1d181 100644 --- a/web/pw-server/src/lib/components/navbar/UserControls.svelte +++ b/web/pw-server/src/lib/components/navbar/UserControls.svelte @@ -1,11 +1,11 @@
- {#if user} + {#if $currentUser}
- {user["username"]} + {$currentUser["username"]}
Sign out
{:else} diff --git a/web/pw-server/src/lib/stores/current_user.ts b/web/pw-server/src/lib/stores/current_user.ts new file mode 100644 index 0000000..ac53070 --- /dev/null +++ b/web/pw-server/src/lib/stores/current_user.ts @@ -0,0 +1,3 @@ +import { writable } from "svelte/store"; + +export const currentUser = writable(null); -- cgit v1.2.3