From 482ffd7b85aadb02bf0b3c490eb9a764ac8cc459 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Thu, 1 Feb 2024 13:23:57 +0100 Subject: [PATCH] feat: try to get user data --- apps/web/src/app.d.ts | 1 + apps/web/src/hooks.server.ts | 15 +- .../lib/components/site/nav/user-nav.svelte | 51 +++ .../lib/components/site/site-navbar.svelte | 11 +- apps/web/src/lib/config/nav.ts | 35 +- .../(dashboard)/+layout.server.ts | 0 .../(components)/data-table-checkbox.svelte | 0 .../data-table-column-header.svelte | 0 .../data-table-faceted-filter.svelte | 0 .../(components)/data-table-pagination.svelte | 4 +- .../data-table-priority-cell.svelte | 0 .../data-table-row-actions.svelte | 6 +- .../data-table-status-cell.svelte | 0 .../(components)/data-table-title-cell.svelte | 0 .../(components)/data-table-toolbar.svelte | 8 +- .../data-table-view-options.svelte | 8 +- .../dashboard/(components)/data-table.svelte | 4 +- .../dashboard/(components)/index.ts | 0 .../(dashboard)/dashboard/(data)/data.ts | 6 +- .../(dashboard)/dashboard/(data)/schemas.ts | 18 ++ .../dashboard/(data)/tickets.json} | 300 ++++++++++++------ .../(auth)/(dashboard)/dashboard/+page.svelte | 13 + .../settings/(components)/sidebar-nav.svelte | 0 .../(dashboard)/settings/+layout.svelte | 0 .../(dashboard)/settings/+page.server.ts | 0 .../(dashboard)/settings/+page.svelte | 0 .../settings/account/+page.server.ts | 0 .../(dashboard)/settings/account/+page.svelte | 0 .../settings/account/account-form.svelte | 0 .../settings/appearance/+page.server.ts | 0 .../settings/appearance/+page.svelte | 0 .../appearance/appearance-form.svelte | 0 .../settings/notifications/+page.server.ts | 0 .../settings/notifications/+page.svelte | 0 .../notifications/notifications-form.svelte | 0 .../(dashboard)/settings/profile-form.svelte | 0 apps/web/src/routes/(auth)/login/+page.svelte | 16 + .../dashboard/(components)/user-nav.svelte | 45 --- .../(dashboard)/dashboard/(data)/schemas.ts | 13 - .../routes/(dashboard)/dashboard/+page.svelte | 18 -- apps/web/src/routes/+layout.server.ts | 32 +- apps/web/src/routes/+layout.svelte | 6 +- 42 files changed, 383 insertions(+), 227 deletions(-) create mode 100644 apps/web/src/lib/components/site/nav/user-nav.svelte rename apps/web/src/routes/{ => (auth)}/(dashboard)/+layout.server.ts (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-checkbox.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-column-header.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-faceted-filter.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-pagination.svelte (96%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-priority-cell.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-row-actions.svelte (91%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-status-cell.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-title-cell.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-toolbar.svelte (84%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table-view-options.svelte (81%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/data-table.svelte (98%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(components)/index.ts (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/dashboard/(data)/data.ts (93%) create mode 100644 apps/web/src/routes/(auth)/(dashboard)/dashboard/(data)/schemas.ts rename apps/web/src/routes/{(dashboard)/dashboard/(data)/tasks.json => (auth)/(dashboard)/dashboard/(data)/tickets.json} (80%) create mode 100644 apps/web/src/routes/(auth)/(dashboard)/dashboard/+page.svelte rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/(components)/sidebar-nav.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/+layout.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/+page.server.ts (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/+page.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/account/+page.server.ts (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/account/+page.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/account/account-form.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/appearance/+page.server.ts (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/appearance/+page.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/appearance/appearance-form.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/notifications/+page.server.ts (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/notifications/+page.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/notifications/notifications-form.svelte (100%) rename apps/web/src/routes/{ => (auth)}/(dashboard)/settings/profile-form.svelte (100%) delete mode 100644 apps/web/src/routes/(dashboard)/dashboard/(components)/user-nav.svelte delete mode 100644 apps/web/src/routes/(dashboard)/dashboard/(data)/schemas.ts delete mode 100644 apps/web/src/routes/(dashboard)/dashboard/+page.svelte diff --git a/apps/web/src/app.d.ts b/apps/web/src/app.d.ts index 3ba5e57..09e8ff8 100644 --- a/apps/web/src/app.d.ts +++ b/apps/web/src/app.d.ts @@ -5,6 +5,7 @@ declare global { namespace App { interface Locals { pocketBase: PocketBase; + user: object; } // interface Error {} // interface PageData {} diff --git a/apps/web/src/hooks.server.ts b/apps/web/src/hooks.server.ts index a2fa874..5d8ff7c 100644 --- a/apps/web/src/hooks.server.ts +++ b/apps/web/src/hooks.server.ts @@ -1,4 +1,4 @@ -import type { Handle } from '@sveltejs/kit'; +import { redirect, type Handle } from '@sveltejs/kit'; import PocketBase from 'pocketbase'; import { pb } from '$lib/pocketbase'; import { PUBLIC_CLIENT_PB } from '$env/static/public'; @@ -10,7 +10,18 @@ export const handle: Handle = async ({ event, resolve }) => { pb.set(event.locals.pocketBase); event.locals.pocketBase.authStore.loadFromCookie(event.request.headers.get('cookie') ?? ''); - + // try { + // //refresh the auth if it is valid + // if (!event.locals.pocketBase.authStore.isValid) + // await event.locals.pocketBase + // .collection('users') + // .authRefresh<{ id: string; email: string }>(); + // //spread the model to locals.user to be available in all pages + // event.locals.user = { ...event.locals.pocketBase.authStore.model }; + // } catch (err) { + // console.log(err, 'error in hooks'); + // event.locals.pocketBase.authStore.clear(); + // } const response = await resolve(event); response.headers.set( diff --git a/apps/web/src/lib/components/site/nav/user-nav.svelte b/apps/web/src/lib/components/site/nav/user-nav.svelte new file mode 100644 index 0000000..9d1e550 --- /dev/null +++ b/apps/web/src/lib/components/site/nav/user-nav.svelte @@ -0,0 +1,51 @@ + + +{#if authenticated} +
{JSON.stringify(user)}
+ + + + + + +
+

BB

+

email@email.com

+
+
+ + + + Profile + ⇧⌘P + + + Settings + ⌘S + + New Dashboard + + + + Log out + ⇧⌘Q + +
+
+{:else} + + +{/if} diff --git a/apps/web/src/lib/components/site/site-navbar.svelte b/apps/web/src/lib/components/site/site-navbar.svelte index 4d75607..7df494f 100644 --- a/apps/web/src/lib/components/site/site-navbar.svelte +++ b/apps/web/src/lib/components/site/site-navbar.svelte @@ -1,7 +1,10 @@
Logo (return home) + {siteConfig.name} - -
+ +
+ +
-
diff --git a/apps/web/src/lib/config/nav.ts b/apps/web/src/lib/config/nav.ts index 6e4b3fe..773c9f9 100644 --- a/apps/web/src/lib/config/nav.ts +++ b/apps/web/src/lib/config/nav.ts @@ -17,26 +17,21 @@ export const navConfig: NavConfig = { href: '/dashboard', auth: true }, - { - title: 'Settings', - href: '/settings', - auth: true - }, - { - title: 'Login', - href: '/login', - auth: false, - }, - { - title: 'Register', - href: '/register', - auth: false, - }, - { - title: 'Logout', - href: '/logout', - auth: true - }, + // { + // title: 'Settings', + // href: '/settings', + // auth: true + // }, + // { + // title: 'Login', + // href: '/login', + // auth: false, + // }, + // { + // title: 'Register', + // href: '/register', + // auth: false, + // }, ], sidebarNav: [] }; diff --git a/apps/web/src/routes/(dashboard)/+layout.server.ts b/apps/web/src/routes/(auth)/(dashboard)/+layout.server.ts similarity index 100% rename from apps/web/src/routes/(dashboard)/+layout.server.ts rename to apps/web/src/routes/(auth)/(dashboard)/+layout.server.ts diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-checkbox.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-checkbox.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-checkbox.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-checkbox.svelte diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-column-header.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-column-header.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-column-header.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-column-header.svelte diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-faceted-filter.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-faceted-filter.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-faceted-filter.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-faceted-filter.svelte diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-pagination.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-pagination.svelte similarity index 96% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-pagination.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-pagination.svelte index 0773949..282a47d 100644 --- a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-pagination.svelte +++ b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-pagination.svelte @@ -7,11 +7,11 @@ DoubleArrowLeft } from "radix-icons-svelte"; import * as Select from "$lib/components/ui/select"; - import type { Task } from "../(data)/schemas"; + import type { Ticket } from "../(data)/schemas"; import type { AnyPlugins } from "svelte-headless-table/plugins"; import type { TableViewModel } from "svelte-headless-table"; - export let tableModel: TableViewModel; + export let tableModel: TableViewModel; const { pageRows, pluginStates, rows } = tableModel; diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-priority-cell.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-priority-cell.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-priority-cell.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-priority-cell.svelte diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-row-actions.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-row-actions.svelte similarity index 91% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-row-actions.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-row-actions.svelte index adfc584..1b8b501 100644 --- a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-row-actions.svelte +++ b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-row-actions.svelte @@ -3,10 +3,10 @@ import { Button } from "$lib/components/ui/button"; import * as DropdownMenu from "$lib/components/ui/dropdown-menu"; import { labels } from "../(data)/data"; - import { taskSchema, type Task } from "../(data)/schemas"; + import { ticketSchema, type Ticket } from "../(data)/schemas"; - export let row: Task; - const task = taskSchema.parse(row); + export let row: Ticket; + const task = ticketSchema.parse(row); diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-status-cell.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-status-cell.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-status-cell.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-status-cell.svelte diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-title-cell.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-title-cell.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-title-cell.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-title-cell.svelte diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-toolbar.svelte b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-toolbar.svelte similarity index 84% rename from apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-toolbar.svelte rename to apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-toolbar.svelte index 3bee89d..cdda69f 100644 --- a/apps/web/src/routes/(dashboard)/dashboard/(components)/data-table-toolbar.svelte +++ b/apps/web/src/routes/(auth)/(dashboard)/dashboard/(components)/data-table-toolbar.svelte @@ -1,15 +1,15 @@ + + diff --git a/apps/web/src/routes/(dashboard)/settings/(components)/sidebar-nav.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/(components)/sidebar-nav.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/(components)/sidebar-nav.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/(components)/sidebar-nav.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/+layout.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/+layout.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/+layout.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/+layout.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/+page.server.ts b/apps/web/src/routes/(auth)/(dashboard)/settings/+page.server.ts similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/+page.server.ts rename to apps/web/src/routes/(auth)/(dashboard)/settings/+page.server.ts diff --git a/apps/web/src/routes/(dashboard)/settings/+page.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/+page.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/+page.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/+page.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/account/+page.server.ts b/apps/web/src/routes/(auth)/(dashboard)/settings/account/+page.server.ts similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/account/+page.server.ts rename to apps/web/src/routes/(auth)/(dashboard)/settings/account/+page.server.ts diff --git a/apps/web/src/routes/(dashboard)/settings/account/+page.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/account/+page.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/account/+page.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/account/+page.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/account/account-form.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/account/account-form.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/account/account-form.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/account/account-form.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/appearance/+page.server.ts b/apps/web/src/routes/(auth)/(dashboard)/settings/appearance/+page.server.ts similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/appearance/+page.server.ts rename to apps/web/src/routes/(auth)/(dashboard)/settings/appearance/+page.server.ts diff --git a/apps/web/src/routes/(dashboard)/settings/appearance/+page.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/appearance/+page.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/appearance/+page.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/appearance/+page.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/appearance/appearance-form.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/appearance/appearance-form.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/appearance/appearance-form.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/appearance/appearance-form.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/notifications/+page.server.ts b/apps/web/src/routes/(auth)/(dashboard)/settings/notifications/+page.server.ts similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/notifications/+page.server.ts rename to apps/web/src/routes/(auth)/(dashboard)/settings/notifications/+page.server.ts diff --git a/apps/web/src/routes/(dashboard)/settings/notifications/+page.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/notifications/+page.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/notifications/+page.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/notifications/+page.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/notifications/notifications-form.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/notifications/notifications-form.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/notifications/notifications-form.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/notifications/notifications-form.svelte diff --git a/apps/web/src/routes/(dashboard)/settings/profile-form.svelte b/apps/web/src/routes/(auth)/(dashboard)/settings/profile-form.svelte similarity index 100% rename from apps/web/src/routes/(dashboard)/settings/profile-form.svelte rename to apps/web/src/routes/(auth)/(dashboard)/settings/profile-form.svelte diff --git a/apps/web/src/routes/(auth)/login/+page.svelte b/apps/web/src/routes/(auth)/login/+page.svelte index 38f2f42..1aa2b61 100644 --- a/apps/web/src/routes/(auth)/login/+page.svelte +++ b/apps/web/src/routes/(auth)/login/+page.svelte @@ -9,6 +9,22 @@ export let form; let isLoading = false; + + // TODO: Implement Microsoft OAuth2 login + // import { PUBLIC_CLIENT_PB } from '$env/static/public'; + // import PocketBase from 'pocketbase'; + // const pb = new PocketBase(PUBLIC_CLIENT_PB); + // async function msLogin() { + // try { + // await pb.collection('users').authWithOAuth2({ provider: 'microsoft' }); + // const input = document.createElement('input'); + // input.type = 'hidden'; + // input.name = 'token'; + // input.value = pb.authStore.token; + // } catch (err) { + // console.error(err); + // } + // }
diff --git a/apps/web/src/routes/(dashboard)/dashboard/(components)/user-nav.svelte b/apps/web/src/routes/(dashboard)/dashboard/(components)/user-nav.svelte deleted file mode 100644 index d54a28b..0000000 --- a/apps/web/src/routes/(dashboard)/dashboard/(components)/user-nav.svelte +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - -
-

shadcn

-

m@example.com

-
-
- - - - Profile - ⇧⌘P - - - Billing - ⌘B - - - Settings - ⌘S - - New Team - - - - Log out - ⇧⌘Q - -
-
diff --git a/apps/web/src/routes/(dashboard)/dashboard/(data)/schemas.ts b/apps/web/src/routes/(dashboard)/dashboard/(data)/schemas.ts deleted file mode 100644 index 2b76124..0000000 --- a/apps/web/src/routes/(dashboard)/dashboard/(data)/schemas.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { z } from "zod"; - -// We're keeping a simple non-relational schema here. -// IRL, you will have a schema for your data models. -export const taskSchema = z.object({ - id: z.string(), - title: z.string(), - status: z.string(), - label: z.string(), - priority: z.string() -}); - -export type Task = z.infer; diff --git a/apps/web/src/routes/(dashboard)/dashboard/+page.svelte b/apps/web/src/routes/(dashboard)/dashboard/+page.svelte deleted file mode 100644 index 0a3de17..0000000 --- a/apps/web/src/routes/(dashboard)/dashboard/+page.svelte +++ /dev/null @@ -1,18 +0,0 @@ - - - diff --git a/apps/web/src/routes/+layout.server.ts b/apps/web/src/routes/+layout.server.ts index 3815607..4866957 100644 --- a/apps/web/src/routes/+layout.server.ts +++ b/apps/web/src/routes/+layout.server.ts @@ -1,7 +1,29 @@ import type { LayoutServerLoad } from './$types'; -export const load: LayoutServerLoad = (async ({ locals }: { locals: App.Locals }) => { - return { - authenticated: locals.pocketBase.authStore.isValid - }; -}); \ No newline at end of file +// export function load({locals}){ +// console.log('base token',locals.userPb.authStore.token); +// console.log('valid',locals.userPb.authStore.isValid); +// if(!locals.userPb.authStore.token) throw redirect(303,'/login'); + +// const user = { +// firstname: locals.userPb.authStore.baseModel.firstname +// } + +// return{ +// user +// } +// } + +export const load: LayoutServerLoad = async ({ locals }: { locals: App.Locals }) => { + if (!locals.pocketBase.authStore.token) { + return { + authenticated: locals.pocketBase.authStore.isValid, + user: locals.pocketBase.authStore.model?.baseModel + }; + } else { + return { + authenticated: locals.pocketBase.authStore.isValid, + user: {} + }; + } +}; diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte index db4a939..12f0dc8 100644 --- a/apps/web/src/routes/+layout.svelte +++ b/apps/web/src/routes/+layout.svelte @@ -4,9 +4,9 @@ import { ModeWatcher } from 'mode-watcher'; import '../app.pcss'; import { fade } from 'svelte/transition'; - import type { PageData } from './$types'; + import type { LayoutData } from './$types'; - export let data: PageData; + export let data: LayoutData; @@ -14,7 +14,7 @@
- +