feat: kick out users who arent signed in

This commit is contained in:
kittentm 2026-03-21 03:42:36 +01:00
commit 50a36e2db4
No known key found for this signature in database
GPG key ID: AC43DFDBC1F44A91
4 changed files with 41 additions and 12 deletions

View file

@ -67,8 +67,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);
})