more auth ree
Some checks failed
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Has been cancelled
CI/CD Pipeline / Build and Push App Docker Image (push) Has been cancelled
CI/CD Pipeline / Deploy to Kubernetes (push) Has been cancelled

This commit is contained in:
yohlo
2026-03-02 23:17:16 -06:00
parent 41cfcc0260
commit fda8751642
2 changed files with 34 additions and 10 deletions

View File

@@ -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 }
});
}