import { submitRegistration } from "backend/registration.web";
$w.onReady(function () {
$w("#htmlRegistration").onMessage(async (event) => {
if (
!event.data ||
event.data.type !== "SUBMIT_REGISTRATION"
) {
return;
}
try {
const result =
await submitRegistration(
event.data.data
);
$w("#htmlRegistration").postMessage({
type: "REGISTRATION_SUCCESS",
registrationId:
result.registrationId,
totalMembers:
result.totalMembers
});
} catch (error) {
console.error(error);
$w("#htmlRegistration").postMessage({
type: "REGISTRATION_ERROR",
message:
error.message ||
"Registration failed. Please try again."
});
}
});
});
top of page
bottom of page