Overview
Once auth state exists (FE-43), pages like /dashboard or /documents need to redirect unauthenticated users to /login rather than rendering and failing on missing data.
Tech
Next.js middleware.ts at the app root, checking for a session cookie/token.
Acceptance Criteria
Overview
Once auth state exists (FE-43), pages like
/dashboardor/documentsneed to redirect unauthenticated users to/loginrather than rendering and failing on missing data.Tech
Next.js
middleware.tsat the app root, checking for a session cookie/token.Acceptance Criteria
middleware.tsmatching protected route prefixes (/dashboard,/documents,/profile,/settings,/admin,/disputes)/login?redirect=<original-path>/admin/*routes additionally verify the user's role and redirect non-admins to/dashboard