mirror of
https://github.com/bartvdbraak/omnidash.git
synced 2025-10-25 21:59:09 +00:00
feat: add profile data
This commit is contained in:
parent
482ffd7b85
commit
5158767019
39 changed files with 42 additions and 66 deletions
|
|
@ -1,29 +1,8 @@
|
|||
import type { LayoutServerLoad } from './$types';
|
||||
|
||||
// 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: {}
|
||||
};
|
||||
}
|
||||
return {
|
||||
authenticated: locals.pocketBase.authStore.isValid,
|
||||
user: locals.pocketBase.authStore.model,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
</main>
|
||||
<SiteFooter />
|
||||
{#if dev}
|
||||
<!-- <pre>{JSON.stringify(data, null, 2)}</pre> -->
|
||||
<TailwindIndicator />
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue