Skip to content

Commit 499c564

Browse files
committed
ref: Update components to Svelte 5 syntax
1 parent 0beb5ed commit 499c564

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/lib/stores/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Admin, Record } from 'pocketbase'
1+
import type { AuthModel } from 'pocketbase'
22
import { writable } from 'svelte/store'
33

4-
export const currentUser = writable<Record | Admin | null>()
4+
export const currentUser = writable<AuthModel | null>()

src/routes/+layout.svelte

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
<script lang="ts">
22
import '../app.postcss'
33
4+
import type { Snippet } from 'svelte'
45
import { applyAction, enhance } from '$app/forms'
56
import { pb } from '$lib/pocketbase'
67
import { currentUser } from '$lib/stores/user'
78
import type { PageData } from './$types'
89
9-
export let data: PageData
10+
interface Props {
11+
data: PageData
12+
children?: Snippet
13+
}
14+
15+
let { data, children }: Props = $props()
1016
1117
// Set the current user from the data passed in from the server
12-
$: currentUser.set(data.user)
18+
$effect(() => {
19+
currentUser.set(data.user)
20+
})
1321
</script>
1422

1523
<div class="bg-neutral text-neutral-content">
@@ -45,5 +53,5 @@
4553
</div>
4654

4755
<div class="max-w-xl mx-auto py-8 px-4">
48-
<slot />
56+
{@render children?.()}
4957
</div>

0 commit comments

Comments
 (0)