Added check for if login cookie expires

This commit is contained in:
WardPearce
2026-02-14 04:17:22 +13:00
parent 18124eddc2
commit 8359695994
2 changed files with 16 additions and 1 deletions
+7 -1
View File
@@ -256,7 +256,13 @@
setAmoledTheme();
if (isLoggedIn && !isYTBackend()) {
loadNotifications().catch(() => authStore.set(null));
loadNotifications().catch(() => logout());
}
if ($rawMasterKeyStore) {
fetch('/api/user/isLoggedIn', { method: 'GET', credentials: 'same-origin' }).catch(() => {
logout();
});
}
resetScroll();
@@ -0,0 +1,9 @@
import { error } from '@sveltejs/kit';
export async function GET({ locals }) {
if (!locals.userId) {
throw error(401);
}
return new Response();
}