Added cookies

This commit is contained in:
2022-07-26 10:18:49 +01:00
parent adeb8c4267
commit 8e81dccef6
8 changed files with 91 additions and 120 deletions
@@ -51,13 +51,7 @@ const handleSubmit = async (password, authTokens) => {
//force a logout
const result2 = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/logout`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
token: authTokens.refreshToken
})
method: 'DELETE'
});
if (!result2.ok) {
@@ -65,7 +59,6 @@ const handleSubmit = async (password, authTokens) => {
}
authTokens.setAccessToken('');
authTokens.setRefreshToken('');
return [null];
};
+1 -8
View File
@@ -12,13 +12,7 @@ const Logout = () => {
{ /* Logout logs you out of the server too */ }
<Link to='/' onClick={async () => {
const result = await authTokens.tokenFetch(`${process.env.AUTH_URI}/auth/logout`, { //NOTE: this gets overwritten as a bugfix
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
token: authTokens.refreshToken
})
method: 'DELETE'
});
//any problems?
@@ -26,7 +20,6 @@ const Logout = () => {
console.error(await result.text());
} else {
authTokens.setAccessToken('');
authTokens.setRefreshToken('');
}
}}>Logout</Link>
</>