mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 06:56:35 +00:00
feat(roadtrip): share trip preferences and improve service stops
This commit is contained in:
@@ -13,7 +13,7 @@ import { getOfflinePrefs } from './offlinePrefs'
|
||||
import { randomId } from '../utils/randomId'
|
||||
import type { QueuedMutation } from '../db/offlineDb'
|
||||
import type { Table } from 'dexie'
|
||||
import { assignmentSchema } from '@trek/shared'
|
||||
import { roadtripPreferencesResponseSchema, assignmentSchema } from '@trek/shared'
|
||||
import { cacheAssignment } from '../db/cacheAssignment'
|
||||
|
||||
// Map Dexie table names used in `resource` field → actual Dexie tables.
|
||||
@@ -195,6 +195,10 @@ export const mutationQueue = {
|
||||
headers,
|
||||
})
|
||||
|
||||
if (mutation.resource === 'roadtripPreferences') {
|
||||
const saved = roadtripPreferencesResponseSchema.parse(response.data)
|
||||
await offlineDb.roadtripPreferences.put(saved)
|
||||
}
|
||||
// Apply canonical server response to Dexie
|
||||
if (mutation.resource === 'assignments') {
|
||||
await cacheAssignment(assignmentSchema.parse(response.data.assignment))
|
||||
|
||||
Reference in New Issue
Block a user