diff --git a/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue b/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue index 551d8b3f..160e8c08 100644 --- a/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue +++ b/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue @@ -162,11 +162,7 @@ export default { }, async suggestAccount(start, word) { try { - await this.$store.dispatch('TimelineSpace/Modals/NewToot/Status/searchAccount', word) - this.$store.commit('TimelineSpace/Modals/NewToot/Status/changeOpenSuggest', true) - this.$store.commit('TimelineSpace/Modals/NewToot/Status/changeStartIndex', start) - this.$store.commit('TimelineSpace/Modals/NewToot/Status/changeMatchWord', word) - this.$store.commit('TimelineSpace/Modasl/NewToot/Status/filteredSuggestionFromAccounts') + await this.$store.dispatch('TimelineSpace/Modals/NewToot/Status/suggestAccount', { word: word, start: start }) return true } catch (err) { console.log(err) diff --git a/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts b/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts index d74ac798..75475122 100644 --- a/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts +++ b/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts @@ -94,11 +94,18 @@ type WordStart = { } const actions: ActionTree = { - searchAccount: async ({ commit, rootState }, word: string) => { + suggestAccount: async ({ commit, rootState }, wordStart: WordStart) => { + commit(MUTATION_TYPES.CLEAR_FILTERED_ACCOUNTS) + commit(MUTATION_TYPES.FILTERED_SUGGESTION_FROM_ACCOUNTS) + const { word, start } = wordStart const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1') const res: Response = await client.get('/search', { q: word, resolve: false }) commit(MUTATION_TYPES.UPDATE_FILTERED_ACCOUNTS, res.data.accounts) if (res.data.accounts.length === 0) throw new Error('Empty') + commit(MUTATION_TYPES.CHANGE_OPEN_SUGGEST, true) + commit(MUTATION_TYPES.CHANGE_START_INDEX, start) + commit(MUTATION_TYPES.CHANGE_MATCH_WORD, word) + commit(MUTATION_TYPES.FILTERED_SUGGESTION_FROM_ACCOUNTS) return res.data.accounts }, suggestHashtag: async ({ commit, rootState }, wordStart: WordStart) => {