diff --git a/src/api/subscriber.js b/src/api/subscriber.js index d5b7cef0..1c8be8d0 100644 --- a/src/api/subscriber.js +++ b/src/api/subscriber.js @@ -107,12 +107,16 @@ export function getNcosLevels (options) { }) } export async function getNcosSet () { - let streams = [] - const res = await httpApi.get('api/v2/ncos/sets/') - if (res.data.total_count > 0) { - streams = getJsonBody(res.data)._embedded['ngcp:ncos/sets'] + try { + let streams = [] + const res = await get({ path: 'api/v2/ncos/sets/' }) + if (res?.data?.total_count > 0) { + streams = getJsonBody(res.data)._embedded['ngcp:ncos/sets'] + } + return streams + } catch (err) { + return [] } - return streams } export async function removePreference (id, field) { return await patchRemove({ diff --git a/src/store/user.js b/src/store/user.js index 4470bb76..1b78dc73 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -611,7 +611,7 @@ export default { async getNcosSetSubscriber () { const ncosSet = [] const list = await getNcosSet() - list.forEach((setNcos) => { + list?.forEach((setNcos) => { ncosSet.push({ label: setNcos.name, value: setNcos.id