add locals call
This commit is contained in:
parent
a0ba611df9
commit
f6239792c4
2 changed files with 5 additions and 1 deletions
4
src/app.d.ts
vendored
4
src/app.d.ts
vendored
|
|
@ -3,7 +3,9 @@
|
|||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
interface Locals {
|
||||
auth: () => Promise<{ session: Session; user: User } | null>;
|
||||
}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
|
|
|
|||
|
|
@ -3,5 +3,7 @@ import type { Handle } from '@sveltejs/kit';
|
|||
import { svelteKitHandler } from 'better-auth/svelte-kit';
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
event.locals.auth = () => auth.api.getSession({ headers: event.request.headers });
|
||||
|
||||
return svelteKitHandler({ event, resolve, auth });
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue