Skip to content

Commit

Permalink
fix: prevent error when enpty data from backend
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed Jan 28, 2025
1 parent dc50351 commit cd8a7c5
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/views/Settings/AllowedGroups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,27 @@ export default {
idKey: 0,
}),

mounted() {
this.searchGroup('')
this.getData()
async created() {
await this.searchGroup('')
await this.getData()
},

methods: {
async getData() {
this.loadingGroups = true
const response = await axios.get(
await axios.get(
generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/libresign/groups_request_sign'),
)
if (response.data.ocs.data.data !== '') {
const groupsSelected = JSON.parse(response.data.ocs.data.data)
this.groupsSelected = this.groups.filter(group => {
return groupsSelected.indexOf(group.id) !== -1
.then(({ data }) => {
const groupsSelected = JSON.parse(data.ocs.data.data)
if (!groupsSelected) {
return
}
this.groupsSelected = this.groups.filter(group => {
return groupsSelected.indexOf(group.id) !== -1
})
})
}
.catch((error) => logger.debug('Could not fetch groups_request_sign', { error }))

Check failure on line 90 in src/views/Settings/AllowedGroups.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'logger' is not defined
this.loadingGroups = false
},

Expand Down

0 comments on commit cd8a7c5

Please sign in to comment.