Files
co-lite/solvway-admin-portal/app/lib/services/adminRegistration.ts
T
ngqileandClaude Opus 5.5 9163557945 fix(qr): tell same-named salespeople apart; bilingual consent tick box
Member codes on the event page are labelled "name (username)", as in the
team list, and the consent tick box reads in English and Bahasa Malaysia.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-12-01 13:35:57 +08:00

42 lines
1.5 KiB
TypeScript

import { ApiError, apiGet, apiPut } from "@/app/lib/clientApi";
export interface RegistrationLink {
token: string;
enabled: boolean;
}
export interface EventLinks {
event: RegistrationLink;
members: (RegistrationLink & { userId: number; name: string; username: string })[];
}
export interface MyLink extends RegistrationLink {
eventUuid: string;
eventName: string;
startDate: string;
endDate: string;
location: string;
}
export interface PrivacyNotice {
id: number;
companyId: number;
textEn: string;
textMs: string;
createdBy: string;
createdAt: string;
}
export const getEventLinks = (uuid: string) => apiGet<EventLinks>(`/api/events/${encodeURIComponent(uuid)}/registration-links`);
export const setLinkEnabled = (uuid: string, token: string, enabled: boolean) =>
apiPut(`/api/events/${encodeURIComponent(uuid)}/registration-links/${encodeURIComponent(token)}`, { enabled });
export const getMyLinks = () => apiGet<MyLink[]>("/api/my-registration-links");
export async function getPrivacyNotice(companyId: number): Promise<PrivacyNotice | null> {
try {
return await apiGet<PrivacyNotice>(`/api/companies/${companyId}/privacy-notice`);
} catch (err) {
if (err instanceof ApiError && err.status === 404) return null; // no notice published yet
throw err;
}
}
export const savePrivacyNotice = (companyId: number, body: { textEn: string; textMs: string }) =>
apiPut<PrivacyNotice>(`/api/companies/${companyId}/privacy-notice`, body);