This commit is contained in:
@ -1,16 +1,18 @@
|
||||
---
|
||||
import Layout from 'layouts/Layout.astro';
|
||||
import { getUser } from 'libs/AuthUtils';
|
||||
import Layout from 'layouts/Layout.astro'
|
||||
import PocketBase from 'pocketbase'
|
||||
|
||||
|
||||
const user = await getUser(Astro.cookies);
|
||||
const pb = Astro.locals.pb as PocketBase
|
||||
const auth = pb.authStore
|
||||
const user = auth.model
|
||||
|
||||
if(!user){
|
||||
if(!auth.isValid){
|
||||
return Astro.redirect("/account/login");
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
<Layout title="Account setting">
|
||||
<h1>Bonjour {user.name}</h1>
|
||||
<h1>Bonjour {user!.name}</h1>
|
||||
</Layout>
|
||||
|
Reference in New Issue
Block a user