All files / web/src/routes login.tsx

100% Statements 11/11
75% Branches 3/4
100% Functions 1/1
100% Lines 11/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 141x 1x   1x 1x 5x 5x   5x 2x 2x 5x 1x  
import { createFileRoute, redirect } from '@tanstack/react-router';
import { getAuthStatus } from '@web/api/v1/super-agents/auth';
 
export const Route = createFileRoute('/login')({
  beforeLoad: async () => {
    const authData = await getAuthStatus();
    if (!authData) return;
 
    if (!authData.authRequired || authData.authenticated) {
      throw redirect({ to: '/agents' });
    }
  },
});