Loading dans le login et correction de fuck de login dans l'API
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user