added request-body for play saper

This commit is contained in:
Kostya
2024-01-21 12:15:52 +03:00
parent 9c0f839356
commit 26d4fd8cda
2 changed files with 38 additions and 2 deletions

View File

@@ -54,3 +54,39 @@ export async function GetUserData(AUTHTOKEN, SearchToken) {
console.log('Fetch error')
}
}
export async function ClickCirclePlay(InfoUser, ClickedCell) {
const data = {
PuttedMoney: InfoUser.PuttedMoney,
MinesCount: InfoUser.MinesCount,
UserCredentials: {
SearchToken: InfoUser.SearchToken,
AUTHTOKEN: InfoUser.AUTHTOKEN
},
ClickedCell: {
X: ClickedCell.X,
y: ClickedCell.Y
}
}
try {
const response = await fetch(`${BackendApiUrl}/GameMines/Play`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data),
redirect: 'follow'
})
if (!response.ok) {
console.log('Fetch error:', response.status)
}
console.log(response.json())
return await response.json()
}
catch (error) {
console.error('Fetch error')
}
}

View File

@@ -135,7 +135,8 @@
import ChatComponent from "@/components/ChatComponent.vue";
import AsideBarElement from "@/components/AsidebarComponent.vue";
import HeaderElementPage from "@/components/HeaderComponent.vue";
import { GetPercentageSteps, GetUserData } from "@/assets/js/games/saper/SaperAPI";
import { GetPercentageSteps, GetUserData, ClickCirclePlay } from "@/assets/js/games/saper/SaperAPI";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods";
import { GetCookie } from "@/assets/js/storage/CookieStorage";
import { Swiper, SwiperSlide } from 'swiper/vue';
@@ -148,7 +149,6 @@ SwiperCore.use([Navigation]);
import '@/assets/css/PagesStyles/games-pages/saper.css'
import SaperNumbers from "@/mocks/SaperNumbers";
import {GetCurrentMoney} from "@/assets/js/rest/RestMethods";
export default {
components: {ChatComponent, HeaderElementPage, AsideBarElement, Swiper, SwiperSlide },