mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Don't chane the filterPostsMenu with state
@mattwr18 state is the root of all evil
This commit is contained in:
parent
cea206d118
commit
a8cfe96f60
@ -183,7 +183,6 @@ export default {
|
||||
isAdmin: 'auth/isAdmin',
|
||||
quickSearchResults: 'search/quickResults',
|
||||
quickSearchPending: 'search/quickPending',
|
||||
showFilterPostsDropdown: 'default/showFilterPostsDropdown',
|
||||
usersFollowedFilter: 'posts/usersFollowedFilter',
|
||||
categoriesFilter: 'posts/categoriesFilter',
|
||||
}),
|
||||
@ -223,6 +222,10 @@ export default {
|
||||
}
|
||||
return routes
|
||||
},
|
||||
showFilterPostsDropdown() {
|
||||
const [firstRoute] = this.$route.matched
|
||||
return firstRoute.name === 'index'
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
Category(category) {
|
||||
|
||||
@ -5,7 +5,6 @@ import Styleguide from '@human-connection/styleguide'
|
||||
import Filters from '~/plugins/vue-filters'
|
||||
import VTooltip from 'v-tooltip'
|
||||
import FilterMenu from '~/components/FilterMenu/FilterMenu'
|
||||
import { mutations } from '~/store/default'
|
||||
|
||||
const localVue = createLocalVue()
|
||||
|
||||
@ -44,9 +43,6 @@ describe('PostIndex', () => {
|
||||
'posts/usersFollowedFilter': () => {},
|
||||
'posts/categoriesFilter': () => {},
|
||||
},
|
||||
mutations: {
|
||||
'default/SET_SHOW_FILTER_POSTS_DROPDOWN': mutations.SET_SHOW_FILTER_POSTS_DROPDOWN,
|
||||
},
|
||||
})
|
||||
mocks = {
|
||||
$t: key => key,
|
||||
|
||||
@ -92,14 +92,10 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.toggleShowFilterPostsDropdown(true)
|
||||
if (this.hashtag) {
|
||||
this.changeFilterBubble({ tags_some: { name: this.hashtag } })
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.toggleShowFilterPostsDropdown(false)
|
||||
},
|
||||
watch: {
|
||||
Post(post) {
|
||||
this.setPosts(this.Post)
|
||||
@ -122,7 +118,6 @@ export default {
|
||||
methods: {
|
||||
...mapMutations({
|
||||
setPosts: 'posts/SET_POSTS',
|
||||
toggleShowFilterPostsDropdown: 'default/SET_SHOW_FILTER_POSTS_DROPDOWN',
|
||||
}),
|
||||
changeFilterBubble(filter) {
|
||||
if (this.hashtag) {
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
export const state = () => {
|
||||
return {
|
||||
showFilterPostsDropdown: false,
|
||||
}
|
||||
}
|
||||
|
||||
export const getters = {
|
||||
showFilterPostsDropdown(state) {
|
||||
return state.showFilterPostsDropdown || false
|
||||
},
|
||||
}
|
||||
|
||||
export const mutations = {
|
||||
SET_SHOW_FILTER_POSTS_DROPDOWN(state, boolean) {
|
||||
state.showFilterPostsDropdown = boolean || null
|
||||
},
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user