Skip to content

Commit de6c3c2

Browse files
committed
minor(modeling-commons): prevent prerender errors when unable to reach auth service
1 parent 3d860e1 commit de6c3c2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • apps/modeling-commons-frontend/app/plugins

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,14 @@ export default defineNuxtPlugin({
9898
});
9999

100100
const session = await nuxtApp.runWithContext(() => authClient.useSession(useFetchHeaders));
101-
const refresh = () =>
102-
authClient.getSession({ fetchOptions: { headers, credentials: "include" } });
101+
102+
const refresh = () => {
103+
try {
104+
authClient.getSession({ fetchOptions: { headers, credentials: "include" } });
105+
} catch (error) {
106+
console.error("Failed to refresh session:", error);
107+
}
108+
};
103109

104110
return {
105111
provide: {

0 commit comments

Comments
 (0)