added a few things back that i had deleted before when fixing 502, mainly looking at login fetch, so far everything works, no 502 and livereload is sorta a thing
This commit is contained in:
@@ -34,12 +34,12 @@ export class AuthenticationController {
|
|||||||
console.log('ON EST DANS REDIRECT AUTH CONTROLLER');
|
console.log('ON EST DANS REDIRECT AUTH CONTROLLER');
|
||||||
console.log('On redirige');
|
console.log('On redirige');
|
||||||
if (request.user.isEnabledTwoFactorAuth === false)
|
if (request.user.isEnabledTwoFactorAuth === false)
|
||||||
return response.status(200).redirect('http://transcendance:8080');
|
return response.status(200).redirect('http://transcendance:8080/#/profile');
|
||||||
return response.status(200).redirect('http://transcendance:8080/#/2fa');
|
return response.status(200).redirect('http://transcendance:8080/#/2fa');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /api/v2/auth/logout
|
* POST /api/v2/auth/logout
|
||||||
* Route pour déconnecter l'utilisateur
|
* Route pour déconnecter l'utilisateur
|
||||||
*/
|
*/
|
||||||
@Post('logout')
|
@Post('logout')
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Canvas from "./components/Canvas.svelte";
|
import Canvas from "./components/Canvas.svelte";
|
||||||
import { createEventDispatcher } from "svelte";
|
|
||||||
import { push } from "svelte-spa-router";
|
import { push } from "svelte-spa-router";
|
||||||
// import axios from 'axios';
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { loginStatus } from './stores/loginStatusStore.js';
|
import { loginStatus } from './stores/loginStatusStore.js';
|
||||||
import { onDestroy } from 'svelte';
|
|
||||||
|
|
||||||
let dispatch = createEventDispatcher();
|
// tmp for testing
|
||||||
|
let aData = {
|
||||||
|
username: '',
|
||||||
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
// console.log('PROFIL SVELTE');
|
// console.log('PROFIL SVELTE');
|
||||||
console.log('SplashPage testing if logged in')
|
console.log('SplashPage testing if logged in')
|
||||||
// const {data} = await axios.get('http://transcendance:8080/api/v2/user');
|
// const {data} = await axios.get('http://transcendance:8080/api/v2/user');
|
||||||
|
fetch('http://transcendance:8080/api/v2/user')
|
||||||
|
.then((resp) => resp.json())
|
||||||
|
.then((res) => {
|
||||||
|
aData.username = res.username;
|
||||||
|
})
|
||||||
|
console.log(aData);
|
||||||
// if (data) {
|
// if (data) {
|
||||||
// $loginStatus = true;
|
// $loginStatus = true;
|
||||||
// push('/user');
|
// //push('/user');
|
||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -25,13 +31,15 @@
|
|||||||
window.location.href = 'http://transcendance:8080/api/v2/auth';
|
window.location.href = 'http://transcendance:8080/api/v2/auth';
|
||||||
// await fetch ('http://transcendance:8080/api/v2/auth');
|
// await fetch ('http://transcendance:8080/api/v2/auth');
|
||||||
console.log('you are now logged in');
|
console.log('you are now logged in');
|
||||||
push('/profile');
|
//push('/profile');
|
||||||
// it doesn't wait before changing the page tho which is really annoying... maybe the backend needs to be updated idk
|
// it doesn't wait before changing the page tho which is really annoying... maybe the backend needs to be updated idk
|
||||||
// cuz rn i'm doing it in the front and that doesn't seem great...
|
// cuz rn i'm doing it in the front and that doesn't seem great...
|
||||||
}
|
}
|
||||||
|
|
||||||
const logout = async() => {
|
const logout = async() => {
|
||||||
await fetch('http://transcendance:8080/api/v2/auth/logout',);
|
await fetch('http://transcendance:8080/api/v2/auth/logout', {
|
||||||
|
method: 'POST',
|
||||||
|
});
|
||||||
$loginStatus = false;
|
$loginStatus = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,22 +9,24 @@
|
|||||||
import active from 'svelte-spa-router/active'
|
import active from 'svelte-spa-router/active'
|
||||||
// or i could leave them all and not display if they're active?
|
// or i could leave them all and not display if they're active?
|
||||||
|
|
||||||
// import { createEventDispatcher } from 'svelte';
|
|
||||||
|
|
||||||
// let dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
|
|
||||||
let handleClickHome = () => {
|
let handleClickHome = () => {
|
||||||
// dispatch('clickedHome');
|
// dispatch('clickedHome');
|
||||||
// profile?
|
// profile?
|
||||||
|
console.log('clicked home')
|
||||||
push('/profile');
|
push('/profile');
|
||||||
};
|
};
|
||||||
|
|
||||||
let handleClickLogout = () => {
|
let handleClickLogout = async () => {
|
||||||
// dispatch('clickedLogout');
|
// dispatch('clickedLogout');
|
||||||
fetch ('http://transcendance:8080/api/v2/auth/logout');
|
await fetch('http://transcendance:8080/api/v2/auth/logout', {
|
||||||
push('/');
|
method: 'POST',
|
||||||
$loginStatus = false;
|
});
|
||||||
|
console.log('clicked logout header')
|
||||||
|
$loginStatus = false;
|
||||||
|
|
||||||
|
// push('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user