From 0afe04a60a93a76ff1e04a184025eef1525d906a Mon Sep 17 00:00:00 2001 From: Apoorva Ganapathy <161405340+apganapa-adobe@users.noreply.github.com> Date: Mon, 30 Sep 2024 21:00:12 -0700 Subject: [PATCH] Update Event to ESL (#235) --- ecc/scripts/esp-controller.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ecc/scripts/esp-controller.js b/ecc/scripts/esp-controller.js index 8331a0e2..5f65139b 100644 --- a/ecc/scripts/esp-controller.js +++ b/ecc/scripts/esp-controller.js @@ -532,7 +532,7 @@ export async function updateSpeaker(profile, seriesId) { } export async function updateEvent(eventId, payload) { - const { host } = getAPIConfig().esp[getECCEnv()]; + const { host } = getAPIConfig().esl[ECC_ENV]; const raw = JSON.stringify({ ...payload, liveUpdate: false }); const options = await constructRequestOptions('PUT', raw); @@ -545,7 +545,7 @@ 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 }; @@ -553,7 +553,7 @@ export async function updateEvent(eventId, payload) { } export async function publishEvent(eventId, payload) { - const { host } = getAPIConfig().esp[getECCEnv()]; + const { host } = getAPIConfig().esl[ECC_ENV]; const raw = JSON.stringify({ ...payload, published: true, liveUpdate: true }); const options = await constructRequestOptions('PUT', raw); @@ -566,7 +566,7 @@ 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 }; @@ -574,7 +574,7 @@ export async function publishEvent(eventId, payload) { } export async function unpublishEvent(eventId, payload) { - const { host } = getAPIConfig().esp[getECCEnv()]; + const { host } = getAPIConfig().esl[ECC_ENV]; const raw = JSON.stringify({ ...payload, published: false, liveUpdate: true }); const options = await constructRequestOptions('PUT', raw); @@ -587,7 +587,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 };