aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/Login.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/components/Login.svelte')
-rw-r--r--src/lib/components/Login.svelte14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/lib/components/Login.svelte b/src/lib/components/Login.svelte
index 0e52e9c..0ceefe7 100644
--- a/src/lib/components/Login.svelte
+++ b/src/lib/components/Login.svelte
@@ -1,9 +1,8 @@
<script lang='ts'>
import { Avatar, Button, Popover } from 'flowbite-svelte';
import NDK, { NDKNip07Signer, type NDKUserProfile } from '@nostr-dev-kit/ndk';
- import { ndk } from '$lib/ndk';
+ import { signedIn, ndk } from '$lib/ndk';
- let signedIn: boolean = false;
let profile: NDKUserProfile | null = null;
const signInWithExtension = async () => {
@@ -14,15 +13,12 @@
$ndk.signer = signer;
$ndk.activeUser = user;
- const connectPromise = $ndk.connect();
- const fetchProfilePromise = user.fetchProfile();
-
- const [_, extensionUserProfile] = await Promise.all([connectPromise, fetchProfilePromise]);
- profile = extensionUserProfile;
+ await $ndk.connect();
+ profile = await user.fetchProfile();
console.log('NDK signed in with extension and reconnected.');
- signedIn = true;
+ $signedIn = true;
};
const signInWithBunker = () => {
@@ -30,7 +26,7 @@
};
</script>
-{#if signedIn}
+{#if $signedIn}
<Avatar
rounded
class='h-6 w-6 m-4 cursor-pointer'