Some checks failed
CI / Backend Unit Tests (push) Failing after 2m45s
CI / Unit & Component Tests (pull_request) Failing after 2m32s
CI / OCR Service Tests (pull_request) Successful in 27s
CI / Backend Unit Tests (pull_request) Failing after 2m44s
CI / Unit & Component Tests (push) Failing after 2m35s
CI / OCR Service Tests (push) Successful in 30s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
616 B
TypeScript
19 lines
616 B
TypeScript
import { error } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types';
|
|
import { createApiClient } from '$lib/api.server';
|
|
import { getErrorMessage } from '$lib/errors';
|
|
|
|
export const load: PageServerLoad = async ({ params, fetch }) => {
|
|
const api = createApiClient(fetch);
|
|
const result = await api.GET('/api/ocr/training-info/{personId}', {
|
|
params: { path: { personId: params.personId } }
|
|
});
|
|
|
|
if (!result.response.ok) {
|
|
const code = (result.error as unknown as { code?: string })?.code;
|
|
throw error(result.response.status, getErrorMessage(code));
|
|
}
|
|
|
|
return { history: result.data! };
|
|
};
|