Files
flxn-app/src/app/routes/_authed.tsx
yohlo 6fddbbab68
All checks were successful
CI/CD Pipeline / Build and Push App Docker Image (push) Successful in 2m34s
CI/CD Pipeline / Build and Push PocketBase Docker Image (push) Successful in 8s
CI/CD Pipeline / Deploy to Kubernetes (push) Successful in 47s
test auth fix idk
2026-03-02 10:02:13 -06:00

39 lines
992 B
TypeScript

import { redirect, createFileRoute, Outlet } from "@tanstack/react-router";
import Layout from "@/features/core/components/layout";
import { useServerEvents } from "@/hooks/use-server-events";
import { Flex, Loader } from "@mantine/core";
export const Route = createFileRoute("/_authed")({
beforeLoad: ({ context }) => {
console.log('_authed beforeLoad context:', context.auth);
if (!context.auth?.user) {
console.log('_authed: No user in context, redirecting to login');
throw redirect({ to: "/login" });
}
console.log('_authed: User found, allowing access');
return {
auth: {
...context.auth,
user: context.auth.user,
},
};
},
component: () => {
useServerEvents();
return (
<Layout>
<Outlet />
</Layout>
);
},
pendingComponent: () => (
<Layout>
<Flex w='100%' h="40dvh" justify="center" align="flex-end">
<Loader size='xl' />
</Flex>
</Layout>
),
});