added edits from main branch, main -> DevelopCkutls

This commit is contained in:
Kostya
2023-11-26 15:33:41 +03:00
29 changed files with 422 additions and 29 deletions

View File

@@ -31,13 +31,25 @@
border-radius: 20px;
}
.menu__content--slots-icon {
margin-left: 5px
}
.menu__content--cruch-icon {
margin-left: 6px
}
.menu__content--bomb-icon {
margin-left: 6px
}
.menu__content--gamemodes {
display: flex;
text-align: center;
flex-direction: column;
}
.menu__content--gamemodes a {
.menu__content--gamemodes a {
padding: 35% 7%;
}

View File

@@ -0,0 +1,21 @@
import { Post } from '../rest/RestMethods.js';
import { BackendApiUrl } from '@/properties/Сonfig.js';
// export function
// LogIn(authCode) {
// return Post(BackendApiUrl + "/LogIn", { code: authCode }).then((data) => {
// console.log(data);
// return data;
// }).catch(error => {
// console.log(error)
// });
// }
export async function LogIn(authCode) {
try {
const response = await Post(BackendApiUrl + "/Authorize/LogIn", { code: authCode });
console.log(response);
return response;
} catch (error) {
console.error('Ошибка в LogIn:', error);
}
}

View File

@@ -0,0 +1,10 @@
export function
GetAuthCodeFromCurrentPath() {
const currentPath = window.location.pathname;
const parts = currentPath.split('/');
const code = parts[parts.length - 1];
return code;
}

View File

@@ -0,0 +1,41 @@
export async function Post(url = "", data = {}) {
// Default options are marked with *
// try {
// const response = await fetch(url, {
// method: "POST",
// headers: {
// "Content-Type": "application/json",
// },
// redirect: "follow",
// referrerPolicy: "no-referrer",
// body: JSON.stringify(data),
// });
// if (!response.ok) {
// console.log("Fetch error:", response.status);
// }
// return await response.json();
// } catch (error) {
// console.log("Fetch error:", error);
// }
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify(data);
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch(url, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
}