forked from spacebar/SplatNet
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
|
|
@ -65,8 +65,15 @@ window.loadHeader(function(headerContainer) {
|
|||
if (cached) renderData(JSON.parse(cached));
|
||||
|
||||
fetch("/api/v1/me", { credentials: 'include' })
|
||||
.then(res => res.ok ? res.json() : Promise.reject(res))
|
||||
.then(res => {
|
||||
if (res.redirected) {
|
||||
window.location.href = res.url;
|
||||
return;
|
||||
}
|
||||
return res.ok ? res.json() : Promise.reject(res);
|
||||
})
|
||||
.then(data => {
|
||||
if (!data) return;
|
||||
sessionStorage.setItem('user_cache', JSON.stringify(data));
|
||||
renderData(data);
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue