diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-31 01:49:34 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-31 01:49:34 +0900 |
| commit | 7a06def8085b432994dc054037183795e7ec25a0 (patch) | |
| tree | 95456a82897787bac87c350dbc65cad6f35e4ebd /frontend/app/routes/admin.dashboard.tsx | |
| parent | 19a75493f5897685cb36c66c7bb3d31ea6a6bd2d (diff) | |
| parent | 5bcffc6a83021b2bcb06b8c6f622a1d623fc753e (diff) | |
| download | iosdc-japan-2024-albatross-7a06def8085b432994dc054037183795e7ec25a0.tar.gz iosdc-japan-2024-albatross-7a06def8085b432994dc054037183795e7ec25a0.tar.zst iosdc-japan-2024-albatross-7a06def8085b432994dc054037183795e7ec25a0.zip | |
Merge branch 'admin'
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> + ); +} |
