feat(scheduling): add frontend types and API client
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
23
src/modules/scheduling/api.ts
Normal file
23
src/modules/scheduling/api.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { fetchJson } from '../../auth/api-client';
|
||||
import type { SchedulingResponse } from './types';
|
||||
|
||||
const BASE = '/api/scheduling';
|
||||
|
||||
export async function fetchSuggestions(targetId?: number): Promise<SchedulingResponse> {
|
||||
const params = new URLSearchParams();
|
||||
if (targetId !== undefined) params.set('targetId', String(targetId));
|
||||
const qs = params.toString();
|
||||
return fetchJson<SchedulingResponse>(`${BASE}/suggestions${qs ? `?${qs}` : ''}`);
|
||||
}
|
||||
|
||||
export async function sendNotify(body: {
|
||||
suggestionId: string;
|
||||
currentPlate: string;
|
||||
candidatePlate: string;
|
||||
}): Promise<{ success: boolean; message: string }> {
|
||||
return fetchJson<{ success: boolean; message: string }>(`${BASE}/notify`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user