This commit is contained in:
@@ -114,6 +114,16 @@ export function isFabDrag(deltaX: number, deltaY: number, threshold = 8) {
|
||||
return Math.hypot(deltaX, deltaY) >= threshold
|
||||
}
|
||||
|
||||
let habitGridCache: { week: string; habits: unknown[] } | null = null
|
||||
|
||||
export function readHabitGridCache<T>(week: string): T[] | null {
|
||||
return habitGridCache?.week === week ? habitGridCache.habits as T[] : null
|
||||
}
|
||||
|
||||
export function writeHabitGridCache<T>(week: string, habits: T[]) {
|
||||
habitGridCache = { week, habits }
|
||||
}
|
||||
|
||||
export function formatApiErrorDetail(detail: unknown): string {
|
||||
if (typeof detail === 'string') return detail
|
||||
if (Array.isArray(detail)) {
|
||||
|
||||
Reference in New Issue
Block a user