abandoned valid login check

This commit is contained in:
Gabe Farrell 2023-04-18 21:49:33 -04:00
parent 7b7abf5f67
commit d2312648e7

View file

@ -1,26 +1,9 @@
export function checkLogin() {
var cookies = document.cookie.split(';');
if (getSessionKey() !== null) {
// The "session" cookie exists
fetch('https://api.bb.gabefarrell.com/userinfo', {
method: 'GET',
headers: {
'x-session-key': getSessionKey(),
},
})
.then(data => data.json())
.then((result) => {
if (result.status !== 200) {
// key is invalid
handleLogout()
return false
} else {
// key is OK
return true
}
})
return true
} else {
// The "session" cookie doesn't exist or is invalid
// The "session" cookie doesn't exist
return false;
}
}