feat: kick out users who arent signed in
This commit is contained in:
parent
901ef26440
commit
50a36e2db4
4 changed files with 41 additions and 12 deletions
|
|
@ -78,13 +78,21 @@ window.loadHeader(async function(headerContainer) {
|
|||
}
|
||||
|
||||
try {
|
||||
const [profileRes, rotationsData] = await Promise.all([
|
||||
fetch("/api/v1/me", { credentials: 'include' }).then(res => res.ok ? res.json() : {}),
|
||||
const [profileRes] = await Promise.all([
|
||||
fetch("/api/v1/me", { credentials: 'include' }).then(res => {
|
||||
if (res.redirected) {
|
||||
window.location.href = res.url;
|
||||
return {};
|
||||
}
|
||||
return res.ok ? res.json() : {};
|
||||
}),
|
||||
renderStages()
|
||||
]);
|
||||
|
||||
await renderData(profileRes);
|
||||
sessionStorage.setItem('user_cache', JSON.stringify(profileRes));
|
||||
if (profileRes && Object.keys(profileRes).length > 0) {
|
||||
await renderData(profileRes);
|
||||
sessionStorage.setItem('user_cache', JSON.stringify(profileRes));
|
||||
}
|
||||
} catch (err) {
|
||||
if (!cacheReady) {
|
||||
const nameEl = document.getElementById('mii-name');
|
||||
|
|
|
|||
Loading…
Reference in a new issue