Split oversized frontend API client, email service, and admin/booking pages into focused modules while preserving import surfaces, and add Redis-backed queues, stale booking cleanup, stronger auth, and scale deployment configs. Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { fetchApi } from './client';
|
|
import type { LegalPage, LegalPagePublic, LegalPageListItem } from './types';
|
|
|
|
export const legalPagesApi = {
|
|
// Public endpoints
|
|
getAll: (locale?: string) =>
|
|
fetchApi<{ pages: LegalPageListItem[] }>(`/api/legal-pages${locale ? `?locale=${locale}` : ''}`),
|
|
|
|
getBySlug: (slug: string, locale?: string) =>
|
|
fetchApi<{ page: LegalPagePublic }>(`/api/legal-pages/${slug}${locale ? `?locale=${locale}` : ''}`),
|
|
|
|
// Admin endpoints
|
|
getAdminList: () =>
|
|
fetchApi<{ pages: LegalPage[] }>('/api/legal-pages/admin/list'),
|
|
|
|
getAdminPage: (slug: string) =>
|
|
fetchApi<{ page: LegalPage }>(`/api/legal-pages/admin/${slug}`),
|
|
|
|
update: (slug: string, data: {
|
|
contentMarkdown?: string;
|
|
contentMarkdownEs?: string;
|
|
title?: string;
|
|
titleEs?: string;
|
|
}) =>
|
|
fetchApi<{ page: LegalPage; message: string }>(`/api/legal-pages/admin/${slug}`, {
|
|
method: 'PUT',
|
|
body: JSON.stringify(data),
|
|
}),
|
|
|
|
seed: () =>
|
|
fetchApi<{ message: string; seeded: number; pages?: string[] }>('/api/legal-pages/admin/seed', {
|
|
method: 'POST',
|
|
}),
|
|
};
|