Skip to content

Commit e4df1d2

Browse files
committed
minor(modeling-commons): update auth client types
1 parent 0e785ef commit e4df1d2

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

apps/modeling-commons-frontend/app/middleware/onboarding.global.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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

apps/modeling-commons-frontend/app/plugins/auth.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { passkeyClient } from "@better-auth/passkey/client";
22
import 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
}>;

0 commit comments

Comments
 (0)