aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/.server/api/client.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-03-08 10:13:05 +0900
committernsfisis <nsfisis@gmail.com>2025-03-08 10:13:05 +0900
commit8dbdf96e674c1e26d7c98af8d0608f30bc1bf166 (patch)
tree7c82476f6bbbc71d72ab7e71e39559eca197fd95 /frontend/app/.server/api/client.ts
parent54316868c3bec1ff9b04643dfe6c13cf56bf3246 (diff)
parent1e6df136d8202c8adf65948527f4c3e7583b338c (diff)
downloadphperkaigi-2025-albatross-8dbdf96e674c1e26d7c98af8d0608f30bc1bf166.tar.gz
phperkaigi-2025-albatross-8dbdf96e674c1e26d7c98af8d0608f30bc1bf166.tar.zst
phperkaigi-2025-albatross-8dbdf96e674c1e26d7c98af8d0608f30bc1bf166.zip
Merge branch 'phperkaigi-2025-ws-to-polling' into phperkaigi-2025
Diffstat (limited to 'frontend/app/.server/api/client.ts')
-rw-r--r--frontend/app/.server/api/client.ts51
1 files changed, 0 insertions, 51 deletions
diff --git a/frontend/app/.server/api/client.ts b/frontend/app/.server/api/client.ts
deleted file mode 100644
index fef1508..0000000
--- a/frontend/app/.server/api/client.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-import createClient from "openapi-fetch";
-import type { paths } from "./schema";
-
-const apiClient = createClient<paths>({
- baseUrl:
- process.env.NODE_ENV === "development"
- ? "http://localhost:8003/phperkaigi/2025/code-battle/api/"
- : "http://api-server/phperkaigi/2025/code-battle/api/",
-});
-
-export async function apiPostLogin(username: string, password: string) {
- const { data, error } = await apiClient.POST("/login", {
- body: {
- username,
- password,
- },
- });
- 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;
-}