From 5bcffc6a83021b2bcb06b8c6f622a1d623fc753e Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Wed, 31 Jul 2024 01:49:28 +0900
Subject: feat(frontend): implement /admin/dashboard page

---
 frontend/app/routes/dashboard.tsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'frontend/app/routes/dashboard.tsx')

diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx
index 9afee86..badf8c4 100644
--- a/frontend/app/routes/dashboard.tsx
+++ b/frontend/app/routes/dashboard.tsx
@@ -1,4 +1,5 @@
 import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
+import { redirect } from "@remix-run/node";
 import { Link, useLoaderData, Form } from "@remix-run/react";
 import { isAuthenticated } from "../.server/auth";
 import { apiClient } from "../.server/api/client";
@@ -11,6 +12,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
   const { user, token } = await isAuthenticated(request, {
     failureRedirect: "/login",
   });
+  if (user.is_admin) {
+    return redirect("/admin/dashboard");
+  }
   const { data, error } = await apiClient.GET("/games", {
     params: {
       query: {
-- 
cgit v1.3.1

