Fixed isLoggedIn check
This commit is contained in:
@@ -191,13 +191,13 @@
|
||||
async function logout() {
|
||||
if (isYTBackend()) {
|
||||
await clearFeedYTjs();
|
||||
|
||||
if (isOwnBackend()?.internalAuth) {
|
||||
rawMasterKeyStore.set(undefined);
|
||||
fetch('/api/user/logout', { method: 'DELETE' });
|
||||
}
|
||||
}
|
||||
|
||||
if (isOwnBackend()?.internalAuth) {
|
||||
fetch('/api/user/logout', { method: 'DELETE' });
|
||||
}
|
||||
|
||||
rawMasterKeyStore.set(undefined);
|
||||
authStore.set(null);
|
||||
goto(resolve('/', {}));
|
||||
}
|
||||
@@ -260,9 +260,11 @@
|
||||
}
|
||||
|
||||
if ($rawMasterKeyStore) {
|
||||
fetch('/api/user/isLoggedIn', { method: 'GET', credentials: 'same-origin' }).catch(() => {
|
||||
logout();
|
||||
});
|
||||
fetch('/api/user/isLoggedIn', { method: 'GET', credentials: 'same-origin' })
|
||||
.then((resp) => {
|
||||
if (!resp.ok) logout();
|
||||
})
|
||||
.catch(logout);
|
||||
}
|
||||
|
||||
resetScroll();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getUser } from '$lib/server/user.js';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export async function GET({ locals }) {
|
||||
@@ -5,5 +6,7 @@ export async function GET({ locals }) {
|
||||
throw error(401);
|
||||
}
|
||||
|
||||
await getUser(locals.userId);
|
||||
|
||||
return new Response();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user