mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
added request for get percentage-steps in saper-game
This commit is contained in:
28
luckydiamond/src/assets/js/games/saper/SaperAPI.js
Normal file
28
luckydiamond/src/assets/js/games/saper/SaperAPI.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { BackendApiUrl } from '@/properties/Сonfig.js';
|
||||||
|
|
||||||
|
export async function GetPercentageSteps(CrystalsCount) {
|
||||||
|
const data = {
|
||||||
|
minesCount: CrystalsCount
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${BackendApiUrl}/GameMines/GetMultiplierPercentage`, {
|
||||||
|
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)
|
||||||
|
return await response.json()
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log('Fetch Error!')
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -136,6 +136,7 @@
|
|||||||
import ChatComponent from "@/components/ChatComponent.vue";
|
import ChatComponent from "@/components/ChatComponent.vue";
|
||||||
import AsideBarElement from "@/components/AsidebarComponent.vue";
|
import AsideBarElement from "@/components/AsidebarComponent.vue";
|
||||||
import HeaderElementPage from "@/components/HeaderComponent.vue";
|
import HeaderElementPage from "@/components/HeaderComponent.vue";
|
||||||
|
import { GetPercentageSteps } from "@/assets/js/games/saper/SaperAPI";
|
||||||
|
|
||||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||||
import 'swiper/css';
|
import 'swiper/css';
|
||||||
@@ -153,13 +154,33 @@ export default {
|
|||||||
clickedBtn: '',
|
clickedBtn: '',
|
||||||
clickedBtnCrystal : '',
|
clickedBtnCrystal : '',
|
||||||
amountCrystals: 5,
|
amountCrystals: 5,
|
||||||
|
amountSaveCrystals: 0,
|
||||||
balance: 1000,
|
balance: 1000,
|
||||||
amountDeposit: 5,
|
amountDeposit: 5,
|
||||||
flippedCards: [],
|
flippedCards: [],
|
||||||
|
PercentageGameSteps: [],
|
||||||
modules: [ Pagination ]
|
modules: [ Pagination ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
PercentageGameSteps(CrystalsCount) {
|
||||||
|
if (CrystalsCount >= 1) {
|
||||||
|
this.amountSaveCrystals = CrystalsCount
|
||||||
|
setTimeout(() => {
|
||||||
|
try {
|
||||||
|
GetPercentageSteps(this.amountSaveCrystals)
|
||||||
|
.then((response) => {
|
||||||
|
this.PercentageGameSteps.push(response)
|
||||||
|
console.log(response)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error('Error in Percantage', e)
|
||||||
|
}
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
flipCard(index) {
|
flipCard(index) {
|
||||||
if (this.flippedCards.includes(index)) {
|
if (this.flippedCards.includes(index)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user