Skip to content

Commit

Permalink
fix: event api internal enrolment handling
Browse files Browse the repository at this point in the history
KK-1039.

The event api might try to delete content from object that does not
exist, which leads to an error.
  • Loading branch information
nikomakela committed Oct 18, 2024
1 parent ed29312 commit 99b260f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/domain/events/api/EventApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,27 @@ const addEvent: MethodHandler = async (params: MethodHandlerParams) => {
}

if (hasInternalTicketSystem(data)) {
delete data.ticketSystem.url;
delete data.ticketSystem.endTime;
try {
delete data.ticketSystem.url;
delete data.ticketSystem.endTime;
} catch (e) {
// eslint-disable-next-line no-console
console.error(
'Could not delete ticketSystem data from internal event',
e
);
}
} else {
delete data.capacityPerOccurrence;
delete data.duration;
try {
delete data.capacityPerOccurrence;
delete data.duration;
} catch (e) {
// eslint-disable-next-line no-console
console.error(
'Could not delete capacity and duration data from external event',
e
);
}
}

const response = await mutationHandler({
Expand Down

0 comments on commit 99b260f

Please sign in to comment.