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.

877 B
Raw Blame
import { useTripStore } from '../../store/tripStore'

/**
 * Pull the trip back in after a stay was accepted into it.
 *
 * The acceptance is written server-side, so the planner knows nothing about the
 * place it produced until somebody reloads the page — which is exactly what a
 * person should never have to do after pressing a button. Both trip shells call
 * this, which is also why it is a plain function rather than a hook: one line at
 * each call site keeps the desktop and phone copies from drifting.
 *
 * Places and days both, because a stay accepted onto a day creates an assignment
 * as well, and the day rail would otherwise stay one place short.
 */
export async function refreshTripAfterAccept(tripId: number | string): Promise<void> {
  const store = useTripStore.getState()
  await Promise.all([store.refreshPlaces(tripId), store.refreshDays(tripId)])
}