in 3-ai-native-e2e-sample/frontend/src/lib/api.ts [89:112]
simulateTrialData: async (): Promise<ApiResponse<{ events: TrialEvent[] }>> => {
try {
const response = await fetch(`${API_URL}/api/trials/simulate`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-version': API_VERSION,
}
});
if (!response.ok) {
const error = await response.text();
throw new Error(error || 'Failed to simulate trial data');
}
const data = await response.json();
return { data, error: null };
} catch (error) {
return {
data: null,
error: error instanceof Error ? error.message : 'Failed to simulate trial data'
};
}
}