Files
otunes/apps/mobile/lib/session.ts
joshuafhiggins Verified 4a740c918c feat(mobile): add client-first playback caching
- Cache queries and songs across mobile and web
- Show cached content and skeletons during loading
- Move shared playback and cache utilities into Convex client
2026-10-08 17:07:49 -04:00

22 lines
599 B
TypeScript

import type { useRouter } from "expo-router"
import { resetPlaybackStores } from "@otunes/convex/client/playback-store"
import { clearPersistentCache } from "@/lib/persistent-cache"
type AppRouter = ReturnType<typeof useRouter>
/** Forgets this device's cached library and playback state. */
export async function clearLocalData() {
resetPlaybackStores()
await clearPersistentCache()
}
export async function signOutToSignIn(
router: Pick<AppRouter, "replace">,
invalidateSession: () => Promise<void>
) {
await invalidateSession()
await clearLocalData()
router.replace("/signin")
}