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.

774 B
Raw Blame
import type { TourPoiSearchRequest, TourPoiSearchResponse } from '@trek/shared';
import apiClient from './client';

/**
 * PLN-02: places along a tour. A search runs several stretches against the map
 * search on the server, each allowed its own timeout there, so it may take
 * longer than the shared default: up to three rounds of stretches, each asking
 * the Overpass mirrors one after another for about twenty seconds at most.
 */
const POI_SEARCH_TIMEOUT_MS = 75_000;

export const tourPoiSearchApi = {
  search: (tripId: number | string, body: TourPoiSearchRequest, signal?: AbortSignal): Promise<TourPoiSearchResponse> =>
    apiClient
      .post(`/trips/${tripId}/tours/poi-search`, body, { signal, timeout: POI_SEARCH_TIMEOUT_MS })
      .then((r) => r.data),
};