Add more Prerendering
This commit is contained in:
@@ -33,5 +33,15 @@ export const fetchWithToken = (token: string, url: string, params: RequestInit =
|
||||
return value;
|
||||
});
|
||||
|
||||
export const tokenStore = writable((localStorage.getItem("sw-session") ?? ""));
|
||||
tokenStore.subscribe((value) => localStorage.setItem("sw-session", value));
|
||||
export function getLocalStorage() {
|
||||
if (typeof localStorage === "undefined") {
|
||||
return {
|
||||
getItem: () => "",
|
||||
setItem: () => {},
|
||||
};
|
||||
}
|
||||
return localStorage;
|
||||
}
|
||||
|
||||
export const tokenStore = writable((getLocalStorage().getItem("sw-session") ?? ""));
|
||||
tokenStore.subscribe((value) => getLocalStorage().setItem("sw-session", value));
|
||||
|
||||
@@ -70,5 +70,8 @@ export const branches = cached<string[]>([], async () => {
|
||||
|
||||
export const server = derived(dataRepo, $dataRepo => $dataRepo.getServer());
|
||||
|
||||
export const isWide = writable(window.innerWidth >= 640);
|
||||
window.addEventListener("resize", () => isWide.set(window.innerWidth >= 640));
|
||||
export const isWide = writable(typeof window !== "undefined" && window.innerWidth >= 640);
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
window.addEventListener("resize", () => isWide.set(window.innerWidth >= 640));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user