feat: add caching for backend objects

This commit is contained in:
2026-04-21 19:38:57 -04:00
parent 5b4955f07e
commit 7f1e82acc2
14 changed files with 637 additions and 62 deletions

View File

@@ -0,0 +1,26 @@
import type { Database } from '~/types/supabase'
type Boat = Database['public']['Tables']['boats']['Row']
export interface BookingDraft {
boat: Boat
startTime: string
endTime: string
}
const _draft = ref<BookingDraft | null>(null)
export function useBookingDraft() {
function set(boat: Boat, startTime: string, endTime: string): void {
_draft.value = { boat, startTime, endTime }
}
/** Reads and clears the draft — call once in the destination page. */
function take(): BookingDraft | null {
const val = _draft.value
_draft.value = null
return val
}
return { set, take }
}