Feat : various fixes, sounds and multiplayer additions

This commit is contained in:
2024-07-03 23:27:10 +02:00
parent 866a537924
commit 25cf8a55e9
16 changed files with 433 additions and 272 deletions
+21 -3
View File
@@ -48,7 +48,25 @@ export async function whoami() {
export async function createGame() {
const config = useRuntimeConfig();
await $fetch<User>(new URL("/games", config.public.endpoint).href, {
const res = await $fetch<Game>(new URL("/games", config.public.endpoint).href, {
method: "POST",
credentials: "include",
});
console.log(res)
navigateTo("/game/" + res._id)
}
export async function startGame(game: string) {
const config = useRuntimeConfig();
const res = await $fetch<Game>(new URL(`games/${game}/start`, config.public.endpoint).href, {
method: "POST",
credentials: "include",
});
}
export async function joinGame(game: string) {
const config = useRuntimeConfig();
const res = await $fetch<Game>(new URL(`games/${game}/join`, config.public.endpoint).href, {
method: "POST",
credentials: "include",
});
@@ -56,7 +74,7 @@ export async function createGame() {
export async function endTurn(game: string) {
const config = useRuntimeConfig();
await $fetch<User>(
await $fetch(
new URL(`games/${game}/endTurn`, config.public.endpoint).href,
{
method: "POST",
@@ -67,7 +85,7 @@ export async function endTurn(game: string) {
export async function lockCard(game: string, cardId: string) {
const config = useRuntimeConfig();
await $fetch<User>(
await $fetch(
new URL(`games/${game}/turn/lockCard/${cardId}`, config.public.endpoint).href,
{
method: "POST",