init ndk in layout component

This commit is contained in:
@s.roertgen 2025-04-22 11:20:01 +02:00
parent c26760eb6d
commit a8dcc4be11
4 changed files with 95 additions and 23 deletions

View file

@ -2,6 +2,20 @@
import '../app.css';
import Navbar from '$lib/components/Navbar.svelte';
let { children } = $props();
import { onMount } from 'svelte';
import { ndkStore, initNDK } from '$lib/db';
onMount(async () => {
try {
await ndkStore.init();
// You could auto-sign in here if you have stored credentials
// or let the user explicitly sign in from a component
initNDK();
} catch (error) {
console.error('Failed to initialize NDK:', error);
}
});
</script>
<Navbar />

View file

@ -10,10 +10,6 @@
function openModal() {
addBoardModal.showModal();
}
onMount(async () => {
await getBoards();
});
</script>
<div class="flex w-full">