Skip to content

Commit

Permalink
Merge branch 'MWPW-158076' into series-users
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Dec 11, 2024
2 parents 16708a6 + cd10f33 commit 451ae18
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
18 changes: 9 additions & 9 deletions ecc/blocks/event-creation-form/event-creation-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,26 +440,26 @@ async function save(props, toPublish = false) {

let resp = props.response;

const onSave = async () => {
if (!resp.eventId) {
resp = await createEvent(quickFilter(props.payload));
props.eventDataResp = { ...props.eventDataResp, ...resp };
updateDashboardLink(props);
if (resp?.eventId) await handleEventUpdate(props);

if (!resp.error) {
showSaveSuccessMessage(props);
}
};

if (!resp.eventId) {
resp = await createEvent(quickFilter(props.payload));
props.eventDataResp = { ...props.eventDataResp, ...resp };
updateDashboardLink(props);
await onSave();
} else if (!toPublish) {
resp = await updateEvent(
getFilteredCachedResponse().eventId,
getJoinedData(),
);
props.eventDataResp = { ...props.eventDataResp, ...resp };
await onSave();
if (resp?.eventId) await handleEventUpdate(props);

if (!resp.error) {
showSaveSuccessMessage(props);
}
} else if (toPublish) {
resp = await publishEvent(
getFilteredCachedResponse().eventId,
Expand Down
18 changes: 12 additions & 6 deletions ecc/blocks/series-creation-form/series-creation-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,25 +402,31 @@ async function save(props, toPublish = false) {
let resp = props.response;

const onSave = async () => {
if (resp?.seriesId) await handleSeriesUpdate(props);

if (!resp.error) {
showSaveSuccessMessage(props);
}
};

if (!resp.seriesId) {
resp = await createSeries(quickFilter(props.payload));
props.response = { ...props.response, ...resp };
updateDashboardLink(props);
await onSave();

if (resp?.seriesId) await handleSeriesUpdate(props);

if (!resp.error) {
showSaveSuccessMessage(props);
}
} else if (!toPublish) {
resp = await updateSeries(
resp.seriesId,
getJoinedData(),
);
props.response = { ...props.response, ...resp };
await onSave();

if (resp?.seriesId) await handleSeriesUpdate(props);

if (!resp.error) {
showSaveSuccessMessage(props);
}
} else if (toPublish) {
resp = await publishSeries(
resp.seriesId,
Expand Down
2 changes: 1 addition & 1 deletion ecc/scripts/esp-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ export async function getSeriesById(seriesId) {

export async function createSeries(seriesData) {
const { host } = API_CONFIG.esp[getEventServiceEnv()];
const raw = JSON.stringify(seriesData);
const raw = JSON.stringify({ ...seriesData, seriesStatus: 'draft' });
const options = await constructRequestOptions('POST', raw);

try {
Expand Down

0 comments on commit 451ae18

Please sign in to comment.