v1.4 - Login fixes, etc
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { writable } from 'svelte/store';
|
||||
import { readable, writable } from 'svelte/store';
|
||||
|
||||
export type AppSession = {
|
||||
name: string;
|
||||
@@ -74,5 +74,19 @@ export function hasStoredAdminSession() {
|
||||
return getStoredAdminSession() !== null;
|
||||
}
|
||||
|
||||
export const sessionHydrated = readable(false, (set) => {
|
||||
if (!browser) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const frame = window.requestAnimationFrame(() => {
|
||||
set(true);
|
||||
});
|
||||
|
||||
return () => {
|
||||
window.cancelAnimationFrame(frame);
|
||||
};
|
||||
});
|
||||
|
||||
export const clientSession = createSessionStore(CLIENT_STORAGE_KEY);
|
||||
export const adminSession = createSessionStore(ADMIN_STORAGE_KEY);
|
||||
|
||||
Reference in New Issue
Block a user