more auth ree
This commit is contained in:
@@ -55,11 +55,17 @@ export const getSessionContext = createServerOnlyFn(async (request: Request, opt
|
||||
if (options?.isServerFunction) {
|
||||
throw new Error("SESSION_REFRESH_REQUIRED");
|
||||
}
|
||||
|
||||
|
||||
const url = new URL(request.url);
|
||||
|
||||
if (url.pathname === '/refresh-session') {
|
||||
logger.warn("Already on refresh-session page but session needs refresh - treating as unauthenticated");
|
||||
throw new Error("Unauthenticated");
|
||||
}
|
||||
|
||||
const from = encodeURIComponent(url.pathname + url.search);
|
||||
throw redirect({
|
||||
to: "/refresh-session",
|
||||
throw redirect({
|
||||
to: "/refresh-session",
|
||||
search: { redirect: from }
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user