Redirect if disabled list is empty
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
a2d96128be
commit
85f5ae9264
File diff suppressed because one or more lines are too long
|
@ -139,8 +139,14 @@ export default {
|
|||
return this.$store.getters.getServerData;
|
||||
},
|
||||
filteredUsers() {
|
||||
if (this.route.hash === '#group_disabled') {
|
||||
return this.users.filter(user => user.enabled !== true);
|
||||
if (this.$route.hash === '#group_disabled') {
|
||||
let disabledUsers = this.users.filter(user => user.enabled !== true);
|
||||
if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) {
|
||||
// disabled group is empty, redirection to all users
|
||||
window.location.hash = '#group_everyone';
|
||||
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
|
||||
}
|
||||
return disabledUsers;
|
||||
}
|
||||
return this.users.filter(user => user.enabled === true);
|
||||
},
|
||||
|
@ -169,12 +175,9 @@ export default {
|
|||
usersLimit() {
|
||||
return this.$store.getters.getUsersLimit;
|
||||
},
|
||||
route() {
|
||||
return this.$store.getters.getRoute;
|
||||
},
|
||||
// get selected hash
|
||||
selectedGroup() {
|
||||
let hash = this.route.hash;
|
||||
let hash = this.$route.hash;
|
||||
if (typeof hash === 'string' && hash.length > 0) {
|
||||
// we have a valid hash: groupXXXX
|
||||
// group_XXXX are reserved groups
|
||||
|
|
|
@ -13,12 +13,6 @@ const mutations = {
|
|||
}
|
||||
};
|
||||
|
||||
const getters = {
|
||||
getRoute(state) {
|
||||
return state.route;
|
||||
}
|
||||
};
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
users,
|
||||
|
@ -26,6 +20,5 @@ export default new Vuex.Store({
|
|||
},
|
||||
strict: debug,
|
||||
|
||||
mutations,
|
||||
getters
|
||||
mutations
|
||||
});
|
||||
|
|
|
@ -142,7 +142,7 @@ export default {
|
|||
});
|
||||
|
||||
// Set current group as active
|
||||
let activeGroup = groups.findIndex(group => group.href === this.route.hash);
|
||||
let activeGroup = groups.findIndex(group => group.href === this.$route.hash);
|
||||
if (activeGroup >= 0) {
|
||||
groups[activeGroup].classes.push('active');
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue