diff --git a/ecc/scripts/esp-controller.js b/ecc/scripts/esp-controller.js index dbc25b44..5379b99d 100644 --- a/ecc/scripts/esp-controller.js +++ b/ecc/scripts/esp-controller.js @@ -203,10 +203,14 @@ export async function createVenue(eventId, venueData) { if (!response.ok) { window.lana?.log('Failed to create venue. Status:', response.status, 'Error:', data); - return { ok: response.ok, status: response.status, error: data }; + return { + ok: response.ok, + status: response.status, + error: data.espProvider ? data.espProvider : data + }; } - return data; + return data.espProvider ? data.espProvider : data; } catch (error) { window.lana?.log('Failed to create venue. Error:', error); return { ok: false, status: 'Network Error', error: error.message }; @@ -245,10 +249,14 @@ export async function createEvent(payload) { if (!response.ok) { window.lana?.log('Failed to create event. Status:', response.status, 'Error:', data); - return { ok: response.ok, status: response.status, error: data }; + return { + ok: response.ok, + status: response.status, + error: data.espProvider ? data.espProvider : data, + }; } - return data; + return data.espProvider ? data.espProvider : data; } catch (error) { window.lana?.log('Failed to create event. Error:', error); return { ok: false, status: 'Network Error', error: error.message };