diff options
Diffstat (limited to 'frontend/app/routes/admin.dashboard.tsx')
| -rw-r--r-- | frontend/app/routes/admin.dashboard.tsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/frontend/app/routes/admin.dashboard.tsx b/frontend/app/routes/admin.dashboard.tsx new file mode 100644 index 0000000..d5f3809 --- /dev/null +++ b/frontend/app/routes/admin.dashboard.tsx @@ -0,0 +1,28 @@ +import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; +import { Link } from "@remix-run/react"; +import { isAuthenticated } from "../.server/auth"; + +export const meta: MetaFunction = () => { + return [{ title: "[Admin] Dashboard | iOSDC 2024 Albatross.swift" }]; +}; + +export async function loader({ request }: LoaderFunctionArgs) { + const { user } = await isAuthenticated(request, { + failureRedirect: "/login", + }); + if (!user.is_admin) { + throw new Error("Unauthorized"); + } + return null; +} + +export default function AdminDashboard() { + return ( + <div> + <h1>[Admin] Dashboard</h1> + <p> + <Link to="/admin/users">Users</Link> + </p> + </div> + ); +} |
