Reapply "Merge branch 'main' into DevelopCkutls"

This reverts commit 26ee6ded22.
This commit is contained in:
rafael1209
2024-04-08 23:45:01 +03:00
parent 87816193a2
commit 6601ec2cc9
40 changed files with 2385 additions and 274 deletions

View File

@@ -0,0 +1,69 @@
import { BackendApiUrl } from '@/properties/Сonfig.js';
import {
GetCookie
} from "@/assets/js/storage/CookieStorage.js";
export async function GetNewestDoubleGames() {
try {
const response = await fetch(`${BackendApiUrl}/GameDouble/GetNewestDoubleGames`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
redirect: 'follow'
})
if (!response.ok) {
console.log('Fetch error:', response.status)
}
return await response
}
catch (error) {
console.log('Fetch error')
}
}
export async function JoinGame(amount, betColor) {
let betColorInt = 0;
if (betColor == "red") {
betColorInt = 0;
}
if (betColor == "green") {
betColorInt = 1;
}
if (betColor == "black") {
betColorInt = 2;
}
const data = {
UserCredentials: {
SearchToken: GetCookie("SearchToken"),
AUTHTOKEN: GetCookie("AUTHTOKEN")
},
bet: amount,
betColor: betColorInt
}
try {
const response = await fetch(`${BackendApiUrl}/GameDouble/JoinGame`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data),
redirect: 'follow'
})
if (!response.ok) {
console.log('Fetch error:', response.status)
}
return await response.json()
}
catch (error) {
console.log('Fetch error')
}
}