Skip to content

Commit

Permalink
unified resp for POST and GET
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Oct 9, 2024
1 parent 079a65e commit 6008ece
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions events/blocks/events-form/events-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ function showSuccessMsgFirstScreen(bp) {
bp.form.classList.add('hidden');
bp.eventHero.classList.add('hidden');

const registrationStatus = rsvpData?.espProvider?.registrationStatus;
const { attendeeStatus } = rsvpData;

if (registrationStatus === 'waitlisted') {
if (attendeeStatus === 'waitlisted') {
bp.waitlistSuccessScreen?.classList.remove('hidden');
bp.waitlistSuccessScreen?.querySelector('.first-screen')?.classList.remove('hidden');
}

if (registrationStatus === 'registered') {
if (attendeeStatus === 'registered') {
bp.rsvpSuccessScreen?.classList.remove('hidden');
bp.rsvpSuccessScreen?.querySelector('.first-screen')?.classList.remove('hidden');
}
Expand Down Expand Up @@ -572,15 +572,15 @@ function initFormBasedOnRSVPData(bp) {
const { block } = bp;
const profile = BlockMediator.get('imsProfile');
const rsvpData = BlockMediator.get('rsvpData');
if (validRegistrationStatus.includes(rsvpData.espProvider.registrationStatus)) {
if (validRegistrationStatus.includes(rsvpData.attendeeStatus)) {
showSuccessMsgFirstScreen(bp);
eventFormSendAnalytics(bp, 'Confirmation Modal View');
} else {
personalizeForm(block, profile);
}

BlockMediator.subscribe('rsvpData', ({ newValue }) => {
if (validRegistrationStatus.includes(newValue?.espProvider.registrationStatus)) {
if (validRegistrationStatus.includes(newValue?.attendeeStatus)) {
showSuccessMsgFirstScreen(bp);
eventFormSendAnalytics(bp, 'Confirmation Modal View');
}
Expand Down
5 changes: 2 additions & 3 deletions events/scripts/content-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ async function updateRSVPButtonState(rsvpBtn, miloLibs, eventInfo) {
} else {
defaultState();
}
// RSVP data changed by register submission || rsvp data received on page load
} else if (rsvpData.espProvider?.registrationStatus === 'registered' || rsvpData.attendeeStatus === 'registered') {
} else if (rsvpData.attendeeStatus === 'registered') {
await registeredState();
} else if (rsvpData.espProvider?.registrationStatus === 'waitlisted' || rsvpData.attendeeStatus === 'waitlisted') {
} else if (rsvpData.attendeeStatus === 'waitlisted') {
await waitlistedState();
} else if (!rsvpData.ok) {
// FIXME: temporary solution for ESL returning 500 on ESP 400 response
Expand Down

0 comments on commit 6008ece

Please sign in to comment.