Skip to content

Commit b0c39b1

Browse files
committed
update category reset process
1 parent 2ee1954 commit b0c39b1

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/vuex/modules/category/actions.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ const getCategory = ({commit, state, dispatch}, params) => {
2222
params.page = 1
2323
}
2424

25+
if (typeof window !== 'undefined') {
26+
state.categories = []
27+
state.single = {}
28+
}
29+
2530
return new Promise((resolve, reject) => {
2631
wordpressService.getCategory(null, params.categorySlug, params.parentId).then((responseCategories) => {
2732
state.page = params.page
@@ -57,13 +62,8 @@ const getPost = ({commit, state}, postSlug) => {
5762
})
5863
}
5964

60-
const resetCategories = ({commit, state}) => {
61-
commit('RESET_CATEGORIES')
62-
}
63-
6465
export {
6566
getCategory,
6667
getCategoryPosts,
67-
getPost,
68-
resetCategories
68+
getPost
6969
}

src/vuex/modules/category/mutations.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ const POST_UPDATED = (state, post) => {
22
state.single = post
33
}
44

5-
const RESET_CATEGORIES = (state) => {
6-
state.categories = []
7-
state.single = {}
8-
}
9-
105
export {
11-
POST_UPDATED,
12-
RESET_CATEGORIES
6+
POST_UPDATED
137
}

0 commit comments

Comments
 (0)