diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-01 21:13:11 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-01 21:13:11 +0900 |
| commit | 94d5d89aa59b6d1e53dab280c26e3a8fcb22b7e4 (patch) | |
| tree | 46872e86ed7e42962895e0bfe04064387487523f /frontend/app/routes/admin.games.tsx | |
| parent | 7190fa225d1a559bacfb244fb1295e8bec246906 (diff) | |
| download | phperkaigi-2025-albatross-94d5d89aa59b6d1e53dab280c26e3a8fcb22b7e4.tar.gz phperkaigi-2025-albatross-94d5d89aa59b6d1e53dab280c26e3a8fcb22b7e4.tar.zst phperkaigi-2025-albatross-94d5d89aa59b6d1e53dab280c26e3a8fcb22b7e4.zip | |
refactor(frontend): provide simpler API client
Diffstat (limited to 'frontend/app/routes/admin.games.tsx')
| -rw-r--r-- | frontend/app/routes/admin.games.tsx | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/frontend/app/routes/admin.games.tsx b/frontend/app/routes/admin.games.tsx index 085a97e..00a56d6 100644 --- a/frontend/app/routes/admin.games.tsx +++ b/frontend/app/routes/admin.games.tsx @@ -1,7 +1,7 @@ import type { LoaderFunctionArgs, MetaFunction } from "@remix-run/node"; import { useLoaderData, Link } from "@remix-run/react"; import { isAuthenticated } from "../.server/auth"; -import { apiClient } from "../.server/api/client"; +import { adminApiGetGames } from "../.server/api/client"; export const meta: MetaFunction = () => { return [{ title: "[Admin] Games | 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/games", { - params: { - header: { - Authorization: `Bearer ${token}`, - }, - }, - }); - if (error) { - throw new Error(error.message); - } - return { games: data.games }; + const { games } = await adminApiGetGames(token); + return { games }; } export default function AdminGames() { |
