Fix infiniteLoading state after user add/remove
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
10388eab34
commit
6be9fdaa48
|
@ -206,7 +206,7 @@ export default {
|
|||
if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) {
|
||||
// disabled group is empty, redirection to all users
|
||||
this.$router.push({name: 'users'});
|
||||
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
|
||||
this.$refs.infiniteLoading.stateChanger.reset()
|
||||
}
|
||||
return disabledUsers;
|
||||
}
|
||||
|
@ -253,6 +253,9 @@ export default {
|
|||
usersLimit() {
|
||||
return this.$store.getters.getUsersLimit;
|
||||
},
|
||||
usersCount() {
|
||||
return this.users.length
|
||||
},
|
||||
|
||||
/* LANGUAGES */
|
||||
languages() {
|
||||
|
@ -272,8 +275,22 @@ export default {
|
|||
// watch url change and group select
|
||||
selectedGroup: function (val, old) {
|
||||
this.$store.commit('resetUsers');
|
||||
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
|
||||
this.$refs.infiniteLoading.stateChanger.reset()
|
||||
this.setNewUserDefaultGroup(val);
|
||||
},
|
||||
|
||||
// make sure the infiniteLoading state is changed if we manually
|
||||
// add/remove data from the store
|
||||
usersCount: function(val, old) {
|
||||
// deleting the last user, reset the list
|
||||
if (val === 0 && old === 1) {
|
||||
this.$refs.infiniteLoading.stateChanger.reset()
|
||||
// adding the first user, warn the infiniteLoader that
|
||||
// the list is not empty anymore (we don't fetch the newly
|
||||
// added user as we already have all the info we need)
|
||||
} else if (val === 1 && old === 0) {
|
||||
this.$refs.infiniteLoading.stateChanger.loaded()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -313,7 +330,7 @@ export default {
|
|||
search(query) {
|
||||
this.searchQuery = query;
|
||||
this.$store.commit('resetUsers');
|
||||
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
|
||||
this.$refs.infiniteLoading.stateChanger.reset()
|
||||
},
|
||||
resetSearch() {
|
||||
this.search('');
|
||||
|
@ -336,7 +353,9 @@ export default {
|
|||
quota: this.newUser.quota.id,
|
||||
language: this.newUser.language.code,
|
||||
})
|
||||
.then(() => this.resetForm())
|
||||
.then(() => {
|
||||
this.resetForm()
|
||||
})
|
||||
.catch((error) => {
|
||||
this.loading.all = false;
|
||||
if (error.response && error.response.data && error.response.data.ocs && error.response.data.ocs.meta) {
|
||||
|
|
Loading…
Reference in New Issue