CognxSafeTrack
feat: backlog P0→P3 — toast system, payments, tenant isolation, feedback handler, i18n parity
6dd9bad | const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3001'; | |
| export async function apiRequest<T = any>(endpoint: string, options: RequestInit = {}): Promise<T> { | |
| const res = await fetch(`${API_URL}${endpoint}`, { | |
| ...options, | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| ...options.headers, | |
| }, | |
| }); | |
| if (!res.ok) { | |
| const errorData = await res.json().catch(() => ({})); | |
| const error = new Error(errorData.error || 'Une erreur est survenue'); | |
| (error as any).status = res.status; | |
| throw error; | |
| } | |
| return res.json(); | |
| } | |
| export const apiClient = { | |
| getStudent: (phone: string) => apiRequest(`/v1/student/me?phone=${phone}`), | |
| // Future endpoints can be added here | |
| }; | |