From 060397db262c319073fbc5a825599a1f00d498b1 Mon Sep 17 00:00:00 2001 From: harshbaz Date: Thu, 16 Nov 2023 14:49:50 +0530 Subject: [PATCH] Add logout functionality --- .../(splash)/up-down/wallet/+page.svelte | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/experiments/src/routes/(feed)/(splash)/up-down/wallet/+page.svelte b/packages/experiments/src/routes/(feed)/(splash)/up-down/wallet/+page.svelte index c2bef3f36..91a851a86 100644 --- a/packages/experiments/src/routes/(feed)/(splash)/up-down/wallet/+page.svelte +++ b/packages/experiments/src/routes/(feed)/(splash)/up-down/wallet/+page.svelte @@ -13,6 +13,8 @@ import getDefaultImageUrl from '$lib/utils/getDefaultImageUrl' import { generateRandomName } from '$lib/utils/randomUsername' import { anonUser, authState } from '$stores/auth' import userProfile from '$stores/userProfile' +import { getApp } from 'firebase/app' +import { getAuth, signOut } from 'firebase/auth' import { collection, doc, @@ -69,6 +71,15 @@ async function getTransactions() { } } +async function logoutUser() { + const app = getApp() + const auth = getAuth(app) + await signOut(auth) + $authState.isLoggedIn = false + $authState.userId = $anonUser.id + $authState.accessToken = undefined +} + onMount(() => getTransactions()) @@ -87,7 +98,12 @@ onMount(() => getTransactions()) iconClass="text-white w-6 h-6" />
Welcome!
-
{$userProfile.name}
+
+
{$userProfile.name}
+ +