diff --git a/src/app/commands.ts b/src/app/commands.ts index 928f92f..7a168ab 100644 --- a/src/app/commands.ts +++ b/src/app/commands.ts @@ -46,6 +46,8 @@ import { loadRelay, addSession, subscribe, + clearStorage, + dropSession, } from "@welshman/app" import { COMMENT, @@ -149,6 +151,19 @@ export const loginWithNip46 = async ({ return true } +// Log out + +export const logout = async () => { + const $pubkey = pubkey.get() + + if ($pubkey) { + dropSession($pubkey) + } + + await clearStorage() + localStorage.clear() +} + // Loaders export const loadUserData = ( diff --git a/src/app/components/LogInPassword.svelte b/src/app/components/LogInPassword.svelte index b2842b4..f654dc2 100644 --- a/src/app/components/LogInPassword.svelte +++ b/src/app/components/LogInPassword.svelte @@ -25,7 +25,7 @@ const abortController = new AbortController() - const relays = BURROW_URL.startsWith('http://') + const relays = BURROW_URL.startsWith("http://") ? [normalizeRelayUrl("ws://" + stripProtocol(BURROW_URL))] : [normalizeRelayUrl(BURROW_URL)] diff --git a/src/app/components/LogOut.svelte b/src/app/components/LogOut.svelte index 9222b96..abf210c 100644 --- a/src/app/components/LogOut.svelte +++ b/src/app/components/LogOut.svelte @@ -1,30 +1,28 @@ -