From 94d5d89aa59b6d1e53dab280c26e3a8fcb22b7e4 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Thu, 1 Aug 2024 21:13:11 +0900
Subject: refactor(frontend): provide simpler API client

---
 frontend/app/routes/admin.users.tsx | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

(limited to 'frontend/app/routes/admin.users.tsx')

diff --git a/frontend/app/routes/admin.users.tsx b/frontend/app/routes/admin.users.tsx
index 6c9b60d..c2e4cc7 100644
--- a/frontend/app/routes/admin.users.tsx
+++ b/frontend/app/routes/admin.users.tsx
@@ -1,7 +1,7 @@
 import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node";
 import { useLoaderData } from "@remix-run/react";
 import { isAuthenticated } from "../.server/auth";
-import { apiClient } from "../.server/api/client";
+import { adminApiGetUsers } from "../.server/api/client";
 
 export const meta: MetaFunction = () => {
   return [{ title: "[Admin] Users | iOSDC Japan 2024 Albatross.swift" }];
@@ -14,17 +14,8 @@ export async function loader({ request }: LoaderFunctionArgs) {
   if (!user.is_admin) {
     throw new Error("Unauthorized");
   }
-  const { data, error } = await apiClient.GET("/admin/users", {
-    params: {
-      header: {
-        Authorization: `Bearer ${token}`,
-      },
-    },
-  });
-  if (error) {
-    throw new Error(error.message);
-  }
-  return { users: data.users };
+  const { users } = await adminApiGetUsers(token);
+  return { users };
 }
 
 export default function AdminUsers() {
-- 
cgit v1.3.1

