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 @@ -
+
Are you sure you want
to log out?
diff --git a/src/app/components/ProfileEject.svelte b/src/app/components/ProfileEject.svelte index 45b983b..dff2adb 100644 --- a/src/app/components/ProfileEject.svelte +++ b/src/app/components/ProfileEject.svelte @@ -1 +1,102 @@ -hi + + +
+ +
Export your keys
+
+

Here's what the process looks like:

+ +

+ Once you export your key, you'll be logged out and won't be able to log in using + your email and password any more. Going forward, you'll need to use your signer app instead. +

+ {#if !success} +
+ +

To confirm, please enter your password below:

+ +
+
+ {/if} + + + {#if success} + + {:else} + + {/if} + +