diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-08 10:51:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-08 10:51:41 +0900 |
| commit | a7ce31249948e4f0c1950de93f3c4f7cdda51cf4 (patch) | |
| tree | c4c740f0cccd15f825596f7a115f3b8f8eb8ffa7 /frontend/app/.server/api/client.ts | |
| parent | 7f4d16dca85263dcbc7b3bb29f5fc50f4371739d (diff) | |
| parent | c06d46eae30c9468535fb6af5e9b822acadbbdb6 (diff) | |
| download | phperkaigi-2025-albatross-a7ce31249948e4f0c1950de93f3c4f7cdda51cf4.tar.gz phperkaigi-2025-albatross-a7ce31249948e4f0c1950de93f3c4f7cdda51cf4.tar.zst phperkaigi-2025-albatross-a7ce31249948e4f0c1950de93f3c4f7cdda51cf4.zip | |
Merge branch 'phperkaigi-2025'
Diffstat (limited to 'frontend/app/.server/api/client.ts')
| -rw-r--r-- | frontend/app/.server/api/client.ts | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/frontend/app/.server/api/client.ts b/frontend/app/.server/api/client.ts deleted file mode 100644 index 1c96b7b..0000000 --- a/frontend/app/.server/api/client.ts +++ /dev/null @@ -1,58 +0,0 @@ -import createClient from "openapi-fetch"; -import type { paths } from "./schema"; - -const apiClient = createClient<paths>({ - baseUrl: - process.env.NODE_ENV === "development" - ? "http://localhost:8002/iosdc-japan/2024/code-battle/api/" - : "http://api-server/iosdc-japan/2024/code-battle/api/", -}); - -export async function apiPostLogin( - username: string, - password: string, - registrationToken: string | null, -) { - const { data, error } = await apiClient.POST("/login", { - body: { - username, - password, - ...(registrationToken !== null - ? { registration_token: registrationToken } - : {}), - }, - }); - if (error) throw new Error(error.message); - return data; -} - -export async function apiGetGames(token: string) { - const { data, error } = await apiClient.GET("/games", { - params: { - header: { Authorization: `Bearer ${token}` }, - }, - }); - if (error) throw new Error(error.message); - return data; -} - -export async function apiGetGame(token: string, gameId: number) { - const { data, error } = await apiClient.GET("/games/{game_id}", { - params: { - header: { Authorization: `Bearer ${token}` }, - path: { game_id: gameId }, - }, - }); - if (error) throw new Error(error.message); - return data; -} - -export async function apiGetToken(token: string) { - const { data, error } = await apiClient.GET("/token", { - params: { - header: { Authorization: `Bearer ${token}` }, - }, - }); - if (error) throw new Error(error.message); - return data; -} |
