Feat : add buy gem action
This commit is contained in:
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user