Files
TREK/client/src/repo/placeDetailsRepo.ts
T
Maurice c28604b891 planner: the details refresh reads through a repository, and the form drops what moved out
The fresh lookup behind New place details goes through placeDetailsRepo
(online-only, like the service identity) instead of api/ directly. The form
loses the Translate type and the comment that moved with the head band's
pills, which takes it under its line limit and out of the size baseline; the
maps service suite's test-size entry follows its shorter count.
2026-10-31 03:25:56 +00:00

17 lines
676 B
TypeScript

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;
},
};