Feat : add Leave, kick and game configuration
This commit is contained in:
@@ -50,6 +50,10 @@ export async function startGame(game: string) {
|
||||
);
|
||||
}
|
||||
|
||||
export async function deleteGame(game: string) {
|
||||
const config = useRuntimeConfig();
|
||||
}
|
||||
|
||||
export async function joinGame(game: string) {
|
||||
const config = useRuntimeConfig();
|
||||
const res = await $fetch<Game>(
|
||||
@@ -61,6 +65,28 @@ export async function joinGame(game: string) {
|
||||
);
|
||||
}
|
||||
|
||||
export async function leaveGame(game: string) {
|
||||
const config = useRuntimeConfig();
|
||||
const res = await $fetch<Game>(
|
||||
config.public.endpoint + `/games/${game}/leave`,
|
||||
{
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export async function kickPlayer(game: string, playerId: string) {
|
||||
const config = useRuntimeConfig();
|
||||
const res = await $fetch<Game>(
|
||||
config.public.endpoint + `/games/${game}/kick/${playerId}`,
|
||||
{
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export async function endTurn(game: string) {
|
||||
const config = useRuntimeConfig();
|
||||
await $fetch(config.public.endpoint + `/games/${game}/endTurn`, {
|
||||
|
||||
Reference in New Issue
Block a user