aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/routes/dashboard.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-01 21:35:25 +0900
committernsfisis <nsfisis@gmail.com>2024-08-01 21:35:25 +0900
commitf6443042fbec1bd394439904f3c69e23709f7e6a (patch)
tree46872e86ed7e42962895e0bfe04064387487523f /frontend/app/routes/dashboard.tsx
parent10b9be2c2a46b204f83be7d152ca62bf69e8843e (diff)
parent94d5d89aa59b6d1e53dab280c26e3a8fcb22b7e4 (diff)
downloadphperkaigi-2025-albatross-f6443042fbec1bd394439904f3c69e23709f7e6a.tar.gz
phperkaigi-2025-albatross-f6443042fbec1bd394439904f3c69e23709f7e6a.tar.zst
phperkaigi-2025-albatross-f6443042fbec1bd394439904f3c69e23709f7e6a.zip
Merge branch 'refactor/api'
Diffstat (limited to 'frontend/app/routes/dashboard.tsx')
-rw-r--r--frontend/app/routes/dashboard.tsx18
1 files changed, 3 insertions, 15 deletions
diff --git a/frontend/app/routes/dashboard.tsx b/frontend/app/routes/dashboard.tsx
index 3cc8e13..b93e5d1 100644
--- a/frontend/app/routes/dashboard.tsx
+++ b/frontend/app/routes/dashboard.tsx
@@ -2,7 +2,7 @@ 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";
+import { apiGetGames } from "../.server/api/client";
export const meta: MetaFunction = () => {
return [{ title: "Dashboard | iOSDC Japan 2024 Albatross.swift" }];
@@ -15,22 +15,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
if (user.is_admin) {
return redirect("/admin/dashboard");
}
- const { data, error } = await apiClient.GET("/games", {
- params: {
- query: {
- player_id: user.user_id,
- },
- header: {
- Authorization: `Bearer ${token}`,
- },
- },
- });
- if (error) {
- throw new Error(error.message);
- }
+ const { games } = await apiGetGames(token);
return {
user,
- games: data.games,
+ games,
};
}