mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-07 16:18:57 +00:00
Additive-only: pages still use lib/api/* and constants/queryKeys.ts until the page-migration agents run. Each domain ships api.ts (HTTP moved from lib/api), types.ts (contract re-exports + view types), schemas.ts (contract schema re-exports + form schemas with toRequest mappers), and use-cases.ts (TanStack Query v5 hooks + hierarchical query keys, mirroring current page invalidations and toast-on-error behavior). Adds an explicit vite/vitest alias for the @proposal-system/api-contracts/schemas subpath (package has no exports map) plus a schema/mapper smoke test suite.
10 lines
352 B
TypeScript
10 lines
352 B
TypeScript
// Sites domain — HTTP calls only (no hooks). Moved from lib/api/sites.ts.
|
|
import apiClient from '../../lib/api/client';
|
|
import type { Site } from './types';
|
|
|
|
export const sitesApi = {
|
|
search: async (query: string): Promise<Site[]> => {
|
|
const res = await apiClient.get(`/sites?query=${encodeURIComponent(query)}`);
|
|
return res.data;
|
|
},
|
|
};
|