Matt Rider 1cd3ba907b Set vuex state to reset active button
- when a user clicks on the logo or changes pages, the filter is reset, but the active button didn't update
- still a bug with the active categoryIds since it's not so easy to set the state of an array in vuex
- dry out code for toggleFilters
- fix bug where user clicks on filter by users followed, then filters for categories of those users, then clicks to remove category filter
2019-08-05 14:39:45 +02:00

32 lines
785 B
JavaScript

export const state = () => {
return {
showFilterPostsDropdown: false,
filteredByUsersFollowed: false,
filteredByCategories: false,
}
}
export const getters = {
showFilterPostsDropdown(state) {
return state.showFilterPostsDropdown || false
},
filteredByUsersFollowed(state) {
return state.filteredByUsersFollowed || false
},
filteredByCategories(state) {
return state.filteredByCategories || false
},
}
export const mutations = {
SET_SHOW_FILTER_POSTS_DROPDOWN(state, boolean) {
state.showFilterPostsDropdown = boolean || null
},
SET_FILTERED_BY_FOLLOWERS(state, boolean) {
state.filteredByUsersFollowed = boolean || null
},
SET_FILTERED_BY_CATEGORIES(state, boolean) {
state.filteredByCategories = boolean || null
},
}