diff options
Diffstat (limited to 'frontend/app/routes/dashboard.tsx')
| -rw-r--r-- | frontend/app/routes/dashboard.tsx | 18 |
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, }; } |
