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.

676 B
Raw Blame
import { mapsApi } from '../api/client';
import { requireOnline } from './onlineOnly';

/**
 * A provider's details of a place, looked up fresh (Google, the TREK index or
 * OpenStreetMap, by the id the place carries). **Online-only, no Dexie table:**
 * the point of asking is the current answer, and a cached one would offer the
 * same values again as if they were new.
 */
export const placeDetailsRepo = {
  async details(placeId: string, lang: string): Promise<Record<string, unknown> | null> {
    requireOnline();
    const answer = (await mapsApi.details(placeId, lang)) as { place?: Record<string, unknown> | null } | null;
    return answer?.place ?? null;
  },
};