1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

add group not found error message #11

This commit is contained in:
Daniel Waxweiler
2021-12-09 19:02:49 +01:00
parent 80dd0c9c50
commit 34aaaa7db9
4 changed files with 31 additions and 10 deletions

View File

@@ -47,5 +47,13 @@ export function displayEvents({ data, document, list }) {
export function displayErrorMessage({ data, list }) {
console.error(data)
list.children[0].style.display = 'block'
if (Object.prototype.hasOwnProperty.call(data, 'response') &&
Object.prototype.hasOwnProperty.call(data.response, 'errors') &&
data.response.errors.length > 0 &&
Object.prototype.hasOwnProperty.call(data.response.errors[0], 'code') &&
data.response.errors[0].code === 'group_not_found') {
list.children[1].style.display = 'block'
} else {
list.children[0].style.display = 'block'
}
}