Files
co-lite/solvway-admin-portal/app/lib/services/adminRegistration.ts
T
ngqileandClaude Opus 5.5 08c45e9109 feat(portal): QR self-registration page, event QR card, My QR codes, privacy notice editor
The public /r/<code> page (no admin shell, never redirects a visitor to the
staff login), its proxy sending only the last X-Forwarded-For hop, the event
page's Registration QR card, a My QR codes page in the user menu, and the
super-admin privacy notice editor on Companies.

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

42 lines
1.4 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 })[];
}
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);