mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-20 22:01:45 +00:00
fix(offline): route reservations, budget, files, and FilesPage loads through repo layer
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { budgetApi } from '../../api/client'
|
||||
import { budgetRepo } from '../../repo/budgetRepo'
|
||||
import type { StoreApi } from 'zustand'
|
||||
import type { TripStoreState } from '../tripStore'
|
||||
import type { BudgetItem, BudgetMember } from '../../types'
|
||||
@@ -21,7 +22,7 @@ export interface BudgetSlice {
|
||||
export const createBudgetSlice = (set: SetState, get: GetState): BudgetSlice => ({
|
||||
loadBudgetItems: async (tripId) => {
|
||||
try {
|
||||
const data = await budgetApi.list(tripId)
|
||||
const data = await budgetRepo.list(tripId)
|
||||
set({ budgetItems: data.items })
|
||||
} catch (err: unknown) {
|
||||
console.error('Failed to load budget items:', err)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { filesApi } from '../../api/client'
|
||||
import { fileRepo } from '../../repo/fileRepo'
|
||||
import type { StoreApi } from 'zustand'
|
||||
import type { TripStoreState } from '../tripStore'
|
||||
import type { TripFile } from '../../types'
|
||||
@@ -16,7 +17,7 @@ export interface FilesSlice {
|
||||
export const createFilesSlice = (set: SetState, get: GetState): FilesSlice => ({
|
||||
loadFiles: async (tripId) => {
|
||||
try {
|
||||
const data = await filesApi.list(tripId)
|
||||
const data = await fileRepo.list(tripId)
|
||||
set({ files: data.files })
|
||||
} catch (err: unknown) {
|
||||
console.error('Failed to load files:', err)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { reservationsApi } from '../../api/client'
|
||||
import { reservationRepo } from '../../repo/reservationRepo'
|
||||
import type { StoreApi } from 'zustand'
|
||||
import type { TripStoreState } from '../tripStore'
|
||||
import type { Reservation } from '../../types'
|
||||
@@ -18,7 +19,7 @@ export interface ReservationsSlice {
|
||||
export const createReservationsSlice = (set: SetState, get: GetState): ReservationsSlice => ({
|
||||
loadReservations: async (tripId) => {
|
||||
try {
|
||||
const data = await reservationsApi.list(tripId)
|
||||
const data = await reservationRepo.list(tripId)
|
||||
set({ reservations: data.reservations })
|
||||
} catch (err: unknown) {
|
||||
console.error('Failed to load reservations:', err)
|
||||
|
||||
Reference in New Issue
Block a user