Skip to content

Commit

Permalink
Update Event to ESL (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Sep 25, 2024
1 parent 2d34042 commit f216bfb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ecc/scripts/esp-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ export async function updateSpeaker(profile, seriesId) {
}

export async function updateEvent(eventId, payload) {
const { host } = getAPIConfig().esp[ECC_ENV];
const { host } = getAPIConfig().esl[ECC_ENV];
const raw = JSON.stringify({ ...payload, liveUpdate: false });
const options = await constructRequestOptions('PUT', raw);

Expand All @@ -544,15 +544,15 @@ export async function updateEvent(eventId, payload) {
return { ok: response.ok, status: response.status, error: data };
}

return data;
return data.espProvider || data;
} catch (error) {
window.lana?.log(`Failed to update event ${eventId}. Error:`, error);
return { ok: false, status: 'Network Error', error: error.message };
}
}

export async function publishEvent(eventId, payload) {
const { host } = getAPIConfig().esp[ECC_ENV];
const { host } = getAPIConfig().esl[ECC_ENV];
const raw = JSON.stringify({ ...payload, published: true, liveUpdate: true });
const options = await constructRequestOptions('PUT', raw);

Expand All @@ -565,15 +565,15 @@ export async function publishEvent(eventId, payload) {
return { ok: response.ok, status: response.status, error: data };
}

return data;
return data.espProvider || data;
} catch (error) {
window.lana?.log(`Failed to publish event ${eventId}. Error:`, error);
return { ok: false, status: 'Network Error', error: error.message };
}
}

export async function unpublishEvent(eventId, payload) {
const { host } = getAPIConfig().esp[ECC_ENV];
const { host } = getAPIConfig().esl[ECC_ENV];
const raw = JSON.stringify({ ...payload, published: false, liveUpdate: true });
const options = await constructRequestOptions('PUT', raw);

Expand All @@ -586,7 +586,7 @@ export async function unpublishEvent(eventId, payload) {
return { ok: response.ok, status: response.status, error: data };
}

return data;
return data.espProvider || data;
} catch (error) {
window.lana?.log(`Failed to unpublish event ${eventId}. Error:`, error);
return { ok: false, status: 'Network Error', error: error.message };
Expand Down

0 comments on commit f216bfb

Please sign in to comment.