mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 12:19:31 +02:00
added edits from main branch, main -> DevelopCkutls
This commit is contained in:
@@ -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%;
|
||||
}
|
||||
|
||||
|
||||
21
luckydiamond/src/assets/js/authentication/AuthService.js
Normal file
21
luckydiamond/src/assets/js/authentication/AuthService.js
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export function
|
||||
GetAuthCodeFromCurrentPath() {
|
||||
const currentPath = window.location.pathname;
|
||||
|
||||
const parts = currentPath.split('/');
|
||||
|
||||
const code = parts[parts.length - 1];
|
||||
|
||||
return code;
|
||||
}
|
||||
41
luckydiamond/src/assets/js/rest/RestMethods.js
Normal file
41
luckydiamond/src/assets/js/rest/RestMethods.js
Normal 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));
|
||||
|
||||
|
||||
}
|
||||
@@ -6,10 +6,10 @@
|
||||
</div>
|
||||
<div class="menu__btns--gamemodes">
|
||||
<div class="menu__content--gamemodes">
|
||||
<a href="#"><img src="../assets/icons-menu/slots-icon.svg"></a>
|
||||
<a href="#"><img src="../assets/icons-menu/crush-icon.svg"></a>
|
||||
<a href="#"><img src="../assets/icons-menu/case-icon.png"></a>
|
||||
<a href="#"><img src="../assets/icons-menu/bomb-icon.svg"></a>
|
||||
<a href="#"><img class="menu__content--slots-icon" src="../assets/icons-menu/slots-icon.svg"></a>
|
||||
<a href="#"><img class="menu__content--cruch-icon" src="../assets/icons-menu/crush-icon.svg"></a>
|
||||
<a href="#"><img src="../assets/icons-menu/case-icon.png"></a>
|
||||
<a href="#"><img class="menu__content--bomb-icon" src="../assets/icons-menu/bomb-icon.svg"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu__btn--settings">
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
<script>
|
||||
import '@/assets/css/ComponentsStyles/header.css'
|
||||
// import { GetAuthCodeFromCurrentPath } from '@/assets/js/authentication/LoggingMiddleware.js';
|
||||
import { LogIn } from '@/assets/js/authentication/AuthService.js';
|
||||
|
||||
export default {
|
||||
name: 'Header-Element-page',
|
||||
data() {
|
||||
return {
|
||||
balance: 25000,
|
||||
auth: false
|
||||
}
|
||||
}, created() {
|
||||
try {
|
||||
let authCode = this.$route.query.code;
|
||||
console.log('Auth Code:', authCode);
|
||||
|
||||
if (authCode) {
|
||||
const data = LogIn(authCode);
|
||||
console.log('Auth Data:', data);
|
||||
} else {
|
||||
console.log('Auth Code отсутствует');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Ошибка при аутентификации:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<header class="header">
|
||||
<div class="header__content">
|
||||
@@ -22,16 +51,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="header__auth--discord">
|
||||
<div v-if="auth" class="header__card--discord">
|
||||
<!-- <div v-if="auth" class="header__card--discord">
|
||||
<div class="discord__card--name">
|
||||
<h2>Artemka</h2>
|
||||
<a href="#" @click="auth = false">Выход<span><img src="../assets/icons-header/exit-icon.png"></span></a>
|
||||
</div>
|
||||
<img src="../assets/icons-test/person-icon.svg" alt="test-ico">
|
||||
</div>
|
||||
<div v-else class="header__card--auth">
|
||||
</div> -->
|
||||
<!-- <div v-else class="header__card--auth"> -->
|
||||
<div class="header__card--auth">
|
||||
<div class="auth__card--content">
|
||||
<a href="#" @click="auth = true"><span><img width="30" height="30" src="../assets/icons-header/discord-icon.svg"></span>Вход</a>
|
||||
<a href="https://discord.com/api/oauth2/authorize?client_id=1148644854797176932&redirect_uri=https%3A%2F%2Flucky-diamond.vercel.app&response_type=code&scope=identify" @click="auth = true"><span><img width="30" height="30" src="../assets/icons-header/discord-icon.svg"></span>Вход</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,6 +69,7 @@
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<script>
|
||||
import '@/assets/css/ComponentsStyles/header.css'
|
||||
|
||||
|
||||
2
luckydiamond/src/properties/Сonfig.js
Normal file
2
luckydiamond/src/properties/Сonfig.js
Normal file
@@ -0,0 +1,2 @@
|
||||
export const BackendApiUrl = 'https://spsystemcore20231122004605.azurewebsites.net/api';
|
||||
// export const BackendApiUrl = 'https://localhost:7062/api';
|
||||
Reference in New Issue
Block a user