Feat : add buy gem action

This commit is contained in:
2024-07-07 21:21:54 +02:00
parent 3eba056253
commit 50ea1d456f
2 changed files with 13 additions and 2 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { buyCard } from "~/netcode"; import { buyCard, buyGem } from "~/netcode";
import type { Container, Game } from "~/netcode/interfaces"; import type { Container, Game } from "~/netcode/interfaces";
export interface Props { export interface Props {
@@ -25,7 +25,7 @@ function marketCardClick(e: string) {
} }
function fireGemCardClick(e: string) { function fireGemCardClick(e: string) {
console.log(e); buyGem(props.game._id);
} }
</script> </script>
+11
View File
@@ -113,6 +113,17 @@ export async function buyCard(game: string, cardId: string) {
); );
} }
export async function buyGem(game: string) {
const config = useRuntimeConfig();
await $fetch(
new URL(`games/${game}/turn/buyGem`, config.public.endpoint).href,
{
method: "POST",
credentials: "include",
}
);
}
export async function lockEffect(game: string, effectId: string) { export async function lockEffect(game: string, effectId: string) {
const config = useRuntimeConfig(); const config = useRuntimeConfig();
await $fetch( await $fetch(