16 lines
537 B
TypeScript
16 lines
537 B
TypeScript
import { error } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types';
|
|
import { createApiClient, extractErrorCode } from '$lib/shared/api.server';
|
|
import { getErrorMessage } from '$lib/shared/errors';
|
|
|
|
export const load: PageServerLoad = async ({ fetch }) => {
|
|
const api = createApiClient(fetch);
|
|
const result = await api.GET('/api/ocr/training-info/global');
|
|
|
|
if (!result.response.ok) {
|
|
throw error(result.response.status, getErrorMessage(extractErrorCode(result.error)));
|
|
}
|
|
|
|
return { history: result.data! };
|
|
};
|