Initial commit MKD fixes

This commit is contained in:
Arsen
2026-02-04 00:17:04 +05:00
commit de94ad707b
312 changed files with 138754 additions and 0 deletions

17
hooks/useCachedFetch.ts Executable file
View File

@@ -0,0 +1,17 @@
/** Читает кеш из localStorage */
export function readCache<T>(key: string, fallback: T): T {
try {
const raw = localStorage.getItem(key);
if (!raw) return fallback;
return JSON.parse(raw) as T;
} catch {
return fallback;
}
}
/** Сохраняет в кеш */
export function saveCache(key: string, data: unknown): void {
try {
localStorage.setItem(key, JSON.stringify(data));
} catch (_) {}
}