mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
added API to get-userdata for saper
This commit is contained in:
@@ -26,3 +26,31 @@ export async function GetPercentageSteps(CrystalsCount) {
|
||||
console.log('Fetch Error!')
|
||||
}
|
||||
}
|
||||
|
||||
export async function GetUserData(SearchToken, AuthToken) {
|
||||
const data = {
|
||||
SearchToken: SearchToken,
|
||||
Authtoken: AuthToken
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`${BackendApiUrl}/GameMines/GetCurrentData`, {
|
||||
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')
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,8 @@
|
||||
import ChatComponent from "@/components/ChatComponent.vue";
|
||||
import AsideBarElement from "@/components/AsidebarComponent.vue";
|
||||
import HeaderElementPage from "@/components/HeaderComponent.vue";
|
||||
import { GetPercentageSteps } from "@/assets/js/games/saper/SaperAPI";
|
||||
import { GetPercentageSteps, GetUserData } from "@/assets/js/games/saper/SaperAPI";
|
||||
import { GetCookie } from "@/assets/js/storage/CookieStorage";
|
||||
|
||||
import { Swiper, SwiperSlide } from 'swiper/vue';
|
||||
import 'swiper/css';
|
||||
@@ -185,6 +186,22 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
const AUTHTOKEN = GetCookie('AUTHTOKEN')
|
||||
const SEARCHTOKEN = GetCookie('SearchToken')
|
||||
|
||||
if (AUTHTOKEN !== null && SEARCHTOKEN !== null) {
|
||||
try {
|
||||
await GetUserData(AUTHTOKEN, SEARCHTOKEN)
|
||||
.then(response => {
|
||||
console.log(response)
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.error('Error in GetData', e)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
flipCard(index) {
|
||||
if (this.flippedCards.includes(index)) {
|
||||
|
||||
Reference in New Issue
Block a user