Template
fet : add game delete
This commit is contained in:
+22
-12
@@ -30,6 +30,10 @@ function joinGame() {
|
||||
gameStore.joinGame(gameId);
|
||||
}
|
||||
|
||||
function deleteGame() {
|
||||
gameStore.deleteGame(gameId);
|
||||
}
|
||||
|
||||
const isCurrentTurn = computed(
|
||||
() =>
|
||||
userStore.self && userStore.self?.id == game.value?.currentPlayer?.userId
|
||||
@@ -95,18 +99,24 @@ const selfPlayer = computed(() =>
|
||||
</template>
|
||||
|
||||
{{ game }}
|
||||
<input
|
||||
type="button"
|
||||
v-if="userStore.self && !game.started && game.ownerId == userStore.self.id"
|
||||
value="start"
|
||||
@click="startGame"
|
||||
/>
|
||||
<input
|
||||
type="button"
|
||||
v-if="userStore.self && !game.started && !selfPlayer"
|
||||
value="join"
|
||||
@click="joinGame"
|
||||
/>
|
||||
<template v-if="userStore.self">
|
||||
<template v-if="!game.started">
|
||||
<input
|
||||
type="button"
|
||||
v-if="game.ownerId == userStore.self.id"
|
||||
value="start"
|
||||
@click="startGame"
|
||||
/>
|
||||
<input type="button" v-if="!selfPlayer" value="join" @click="joinGame" />
|
||||
</template>
|
||||
<input
|
||||
v-if="game.ownerId == userStore.self.id"
|
||||
type="button"
|
||||
value="delete"
|
||||
@click="deleteGame"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<div>
|
||||
Messages
|
||||
<span v-for="message in game.messages" :key="message.id">
|
||||
|
||||
Reference in New Issue
Block a user