Namespace overview now does only one request instead of one for each namespace to get all lists

This commit is contained in:
kolaente 2018-09-17 07:34:22 +02:00
parent 17a8f47572
commit 3bc535577c
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -113,24 +113,7 @@
this.namespaces = [] this.namespaces = []
HTTP.get(`namespaces`, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}}) HTTP.get(`namespaces`, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
.then(response => { .then(response => {
this.$set(this, 'namespaces', response.data)
let nps = response.data
// Loop through the namespaces and get their lists
for (const n in nps) {
this.namespaces.push(nps[n])
HTTP.get(`namespaces/` + nps[n].id + `/lists`, {headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')}})
.then(response => {
// This adds a new element "list" to our object which contains all lists
this.$set(this.namespaces[n], 'lists', response.data)
})
.catch(e => {
this.handleError(e)
})
}
this.loading = false this.loading = false
}) })
.catch(e => { .catch(e => {