Skip to content

Commit

Permalink
Encode header fields if they exist on schedule edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Tideman committed Oct 23, 2024
1 parent aacf78e commit 476dbda
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/stores/schedules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
ScheduleSpecParameters,
} from '$lib/types/schedule';
import { encodePayloads } from '$lib/utilities/encode-payload';
import { stringifyWithBigInt } from '$lib/utilities/parse-with-big-int';
import { routeForSchedule, routeForSchedules } from '$lib/utilities/route-for';
import {
convertDaysAndMonths,
Expand Down Expand Up @@ -204,6 +205,18 @@ export const submitEditSchedule = async (
},
};

const fields = body.schedule.action.startWorkflow?.header?.fields;
if (fields && Object.keys(fields).length > 0) {
const entries = Object.entries(fields);
for (const [key, value] of entries) {
const encodedValue = await encodePayloads(
stringifyWithBigInt(value),
'json/plain',
);
fields[key] = encodedValue[0];
}
}

if (preset === 'existing') {
body.schedule.spec = schedule.spec;
} else {
Expand Down

0 comments on commit 476dbda

Please sign in to comment.