refs #985 Move close suggest logic to vuex

This commit is contained in:
AkiraFukushima 2019-08-07 22:22:03 +09:00
parent 2c50d0f744
commit 2a337dc4cf
2 changed files with 9 additions and 6 deletions

View File

@ -207,13 +207,8 @@ export default {
},
closeSuggest() {
if (this.openSuggest) {
this.$store.commit('TimelineSpace/Modals/NewToot/Status/changeOpenSuggest', false)
this.$store.commit('TimelineSpace/Modals/NewToot/Status/changeStartIndex', null)
this.$store.commit('TimelineSpace/Modals/NewToot/Status/changeMatchWord', null)
this.$store.commit('TimelineSpace/Modals/NewToot/Status/closeSuggest')
this.highlightedIndex = 0
this.$store.commit('TimelineSpace/Modals/NewToot/Status/clearFilteredSuggestion')
this.$store.commit('TimelineSpace/Modals/NewToot/Status/clearFilteredAccounts')
this.$store.commit('TimelineSpace/Modals/NewToot/Status/clearFilteredHashtags')
}
},
suggestHighlight(index) {

View File

@ -141,6 +141,14 @@ const actions: ActionTree<StatusState, RootState> = {
return res.data.hashtags
}
await Promise.all([searchCache(), searchAPI()])
},
closeSuggest: ({ commit }) => {
commit(MUTATION_TYPES.CHANGE_OPEN_SUGGEST, false)
commit(MUTATION_TYPES.CHANGE_START_INDEX, null)
commit(MUTATION_TYPES.CHANGE_MATCH_WORD, null)
commit(MUTATION_TYPES.CLEAR_FILTERED_SUGGESTION)
commit(MUTATION_TYPES.CLEAR_FILTERED_ACCOUNTS)
commit(MUTATION_TYPES.CLEAR_FILTERED_HASHTAGS)
}
}