Pages list and Tiptap editor (ported from babyboo) with image upload on save, the FORM event picker, field errors at their fields, delete confirmation, unsaved-edits guard and a draft preview. The public page /p/<company>/<slug> renders on the server with metadata, sanitize-html, the company's logo and accent, and the sign-up form with UTM tags. Companies get branding; the event lead detail shows the web page and campaign. Labels in English and Chinese. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
15 lines
792 B
TypeScript
15 lines
792 B
TypeScript
import { apiGet, apiPost, apiPut } from "@/app/lib/clientApi";
|
|
import type { AdminCompany } from "@/app/lib/types";
|
|
|
|
export const listAdminCompanies = () => apiGet<AdminCompany[]>("/api/companies");
|
|
|
|
/** Create when `id` is absent; otherwise edit name and status. */
|
|
export const saveAdminCompany = (company: Partial<AdminCompany>) => apiPost<AdminCompany>("/api/companies", company);
|
|
|
|
export const changeAdminCompanyCode = (id: number, code: string) =>
|
|
apiPost<AdminCompany>(`/api/companies/${id}/code`, { code });
|
|
|
|
/** Landing-page logo (a page image of this company) and accent colour (#RRGGBB). */
|
|
export const saveCompanyBranding = (id: number, branding: { logoImageId: number | null; accentColor: string | null }) =>
|
|
apiPut<AdminCompany>(`/api/companies/${id}/branding`, branding);
|