Loading dans le login et correction de fuck de login dans l'API

This commit is contained in:
MarcEricMartel
2022-11-06 08:17:01 -08:00
parent f197c05b0c
commit 43cd2bd7c2
5 changed files with 22 additions and 11 deletions

View File

@@ -23,9 +23,9 @@ const App = () => {
const response = await fetch(`https://localhost:7292/api/WhoAmI`, { credentials: 'include' });
if (response.status === 200) {
var user = await response.json();
setCookie('GMGM', {...user, LoggedIn:true}, { path: '/', sameSite:'strict' })
setCookie('GMGM', {...user, LoggedIn:true}, { path: '/', SameSite:'strict' })
}
else setCookie('GMGM', {LoggedIn:false}, { path: '/', sameSite:'strict' })
else setCookie('GMGM', {LoggedIn:false}, { path: '/', SameSite:'strict' })
}
if (cookies.GMGM === null) {
FetchUser();

View File

@@ -14,14 +14,14 @@ const Topbar = () => {
setLogin(cookies.GMGM ?? null);
});
function logOut() {
async function logOut() {
const response = fetch(`https://localhost:7292/api/Logout`, {
method: 'POST',
credentials: 'include'
})
removeCookie("GMGM");
setLogin(null); // Y U NO WORK?!?
await removeCookie("GMGM");
await setLogin(null); // Y U NO WORK?!?
}
return (