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.

783 B
Raw Blame
import { pluginSuggestResultSchema, type PluginSuggestResult } from '@trek/shared'
import { apiClient, parseInDev } from './client'

/**
 * GET /api/plugin-search/suggest (#2221): what the plugins that answer as you type
 * found for the query so far. The place search reaches it through
 * repo/pluginSearchRepo.ts, which adds the offline guard and the strict check.
 */
export const pluginSearchApi = {
  suggest: (
    query: string,
    lang: string,
    near: { lat: number; lng: number } | undefined,
    signal: AbortSignal,
  ): Promise<PluginSuggestResult> =>
    apiClient
      .get('/plugin-search/suggest', { params: { q: query, lang, lat: near?.lat, lng: near?.lng }, signal })
      .then(r => parseInDev(pluginSuggestResultSchema, r.data, 'pluginSearch.suggest')),
}