From 5bcffc6a83021b2bcb06b8c6f622a1d623fc753e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 31 Jul 2024 01:49:28 +0900 Subject: feat(frontend): implement /admin/dashboard page --- frontend/app/routes/admin.dashboard.tsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 frontend/app/routes/admin.dashboard.tsx (limited to 'frontend/app/routes/admin.dashboard.tsx') 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 ( +
+

[Admin] Dashboard

+

+ Users +

+
+ ); +} -- cgit v1.2.3-70-g09d2