React/Vite frontend and Express/SQLite backend for tracking visited and planned cities on a map, with per-city notes, photos, links, and participant-based sharing between family members. Includes session auth with admin-managed user accounts, an OSM/Nominatim geocoding proxy, and a single-image Docker deployment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
12 lines
396 B
TypeScript
12 lines
396 B
TypeScript
import { Navigate } from 'react-router-dom';
|
|
import type { ReactNode } from 'react';
|
|
import { useAuth } from '../../context/AuthContext';
|
|
|
|
export function ProtectedRoute({ children }: { children: ReactNode }) {
|
|
const { user, needsSetup } = useAuth();
|
|
|
|
if (needsSetup) return <Navigate to="/setup" replace />;
|
|
if (!user) return <Navigate to="/login" replace />;
|
|
|
|
return <>{children}</>;
|
|
}
|