Merge pull request 'more auth ree' (#14) from development into main
All checks were successful
CI/CD Pipeline / Build and Push App Docker Image (push) Successful in 2m39s
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Successful in 8s
CI/CD Pipeline / Deploy to Kubernetes (push) Successful in 46s

Reviewed-on: #14
This commit is contained in:
2026-03-02 22:25:29 -06:00
3 changed files with 18 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {
Outlet, Outlet,
Scripts, Scripts,
createRootRouteWithContext, createRootRouteWithContext,
redirect,
} from "@tanstack/react-router"; } from "@tanstack/react-router";
import * as React from "react"; import * as React from "react";
import { DefaultCatchBoundary } from "@/components/DefaultCatchBoundary"; import { DefaultCatchBoundary } from "@/components/DefaultCatchBoundary";
@@ -132,6 +133,15 @@ export const Route = createRootRouteWithContext<{
throw error; 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); console.error('__root beforeLoad error:', error);
return {}; return {};
} }

View File

@@ -23,6 +23,9 @@ export async function ensureServerQueryData<TData>(
if (error?.options?.to && error?.options?.statusCode) { if (error?.options?.to && error?.options?.statusCode) {
throw error; throw error;
} }
if (error instanceof Response && error.status === 440) {
throw error;
}
throw error; throw error;
} }
} }

View File

@@ -34,6 +34,11 @@ export const toServerResult = async <T>(
} }
} }
if (error instanceof Response && error.status === 440) {
logger.info('toServerResult: Re-throwing 440 Response for session refresh');
throw error;
}
const duration = Date.now() - startTime; const duration = Date.now() - startTime;
logger.error('Server Fn Error', error); logger.error('Server Fn Error', error);