Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(offline): route reservations, budget, files, and FilesPage loads through repo layer

jubnl85d72c831d9f
diff --git a/client/src/pages/FilesPage.tsx b/client/src/pages/FilesPage.tsx
index 2a6c4eac8..cb48d5e1f 100644
--- a/client/src/pages/FilesPage.tsx
+++ b/client/src/pages/FilesPage.tsx
@@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react'
import { useParams, useNavigate, Link } from 'react-router-dom'
import { useTripStore } from '../store/tripStore'
-import { tripsApi, placesApi } from '../api/client'
+import { tripRepo } from '../repo/tripRepo'
+import { placeRepo } from '../repo/placeRepo'
import Navbar from '../components/Layout/Navbar'
import FileManager from '../components/Files/FileManager'
import { ArrowLeft } from 'lucide-react'
@@ -27,8 +28,8 @@ export default function FilesPage(): React.ReactElement {
setIsLoading(true)
try {
const [tripData, placesData] = await Promise.all([
- tripsApi.get(tripId),
- placesApi.list(tripId),
+ tripRepo.get(tripId),
+ placeRepo.list(tripId),
])
setTrip(tripData.trip)
setPlaces(placesData.places)
diff --git a/client/src/store/slices/budgetSlice.ts b/client/src/store/slices/budgetSlice.ts
index 04e58fda1..9f63bc45a 100644
--- a/client/src/store/slices/budgetSlice.ts
+++ b/client/src/store/slices/budgetSlice.ts
@@ -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)
diff --git a/client/src/store/slices/filesSlice.ts b/client/src/store/slices/filesSlice.ts
index 07ed0deb3..136175157 100644
--- a/client/src/store/slices/filesSlice.ts
+++ b/client/src/store/slices/filesSlice.ts
@@ -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)
diff --git a/client/src/store/slices/reservationsSlice.ts b/client/src/store/slices/reservationsSlice.ts
index 536d4cb10..c020a593e 100644
--- a/client/src/store/slices/reservationsSlice.ts
+++ b/client/src/store/slices/reservationsSlice.ts
@@ -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)