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

This commit is contained in:
yohlo
2026-03-02 22:25:01 -06:00
parent 76306cc937
commit 2551ff8bb3
3 changed files with 18 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {
Outlet,
Scripts,
createRootRouteWithContext,
redirect,
} from "@tanstack/react-router";
import * as React from "react";
import { DefaultCatchBoundary } from "@/components/DefaultCatchBoundary";
@@ -132,6 +133,15 @@ export const Route = createRootRouteWithContext<{
throw error;
}
if (error instanceof Response && error.status === 440) {
console.log('__root beforeLoad: Session needs refresh, redirecting');
const from = encodeURIComponent(location.pathname + location.search);
throw redirect({
to: "/refresh-session",
search: { redirect: from }
});
}
console.error('__root beforeLoad error:', error);
return {};
}