File tree Expand file tree Collapse file tree
apps/modeling-commons-frontend/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,13 @@ export default defineNuxtRouteMiddleware(async (to) => {
1515 }
1616
1717 const { $auth } = useNuxtApp ( ) ;
18- const session = await $auth . client . getSession ( ) ;
18+
19+ let session : Awaited < ReturnType < typeof $auth . client . getSession > > ;
20+ try {
21+ session = await $auth . client . getSession ( ) ;
22+ } catch {
23+ return ;
24+ }
1925 const user = session ?. data ?. user ;
2026 if ( ! user ) return ;
2127
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { passkeyClient } from "@better-auth/passkey/client";
22import type {
33 BetterAuthClientOptions ,
44 BetterAuthClientPlugin ,
5- InferClientAPI ,
65 IsSignal ,
76 UnionToIntersection ,
87 User as _User ,
@@ -99,7 +98,8 @@ export default defineNuxtPlugin({
9998 } ) ;
10099
101100 const session = await nuxtApp . runWithContext ( ( ) => authClient . useSession ( useFetchHeaders ) ) ;
102- const refresh = ( ) => authClient . updateSession ( { fetchOptions : { headers } } ) ;
101+ const refresh = ( ) =>
102+ authClient . getSession ( { fetchOptions : { headers, credentials : "include" } } ) ;
103103
104104 return {
105105 provide : {
@@ -165,7 +165,4 @@ type ExtendWithPlugin<O extends (...args: any[]) => BetterAuthClientPlugin> = In
165165} > &
166166 InferActions < {
167167 plugins : [ ReturnType < O > ] ;
168- } > &
169- InferClientAPI < {
170- plugins : [ ReturnType < O > ] ;
171168 } > ;
You can’t perform that action at this time.
0 commit comments