From 9466130cf47c021a5367c173f84e7d7546f6e37c Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sun, 11 Aug 2019 11:47:54 +0900
Subject: [PATCH] refs #991 Use v2 API for suggest
---
src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts b/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts
index 76489d7b..2a4905c3 100644
--- a/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts
+++ b/src/renderer/store/TimelineSpace/Modals/NewToot/Status.ts
@@ -154,7 +154,7 @@ const actions: ActionTree = {
})
}
const searchAPI = async () => {
- const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
+ const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v2')
const res: Response = await client.get('/search', { q: word, resolve: false })
if (res.data.accounts.length === 0) throw new Error('Empty')
commit(MUTATION_TYPES.APPEND_FILTERED_ACCOUNTS, res.data.accounts.map(account => account.acct))
@@ -191,11 +191,11 @@ const actions: ActionTree = {
})
}
const searchAPI = async () => {
- const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v1')
+ const client = new Mastodon(rootState.TimelineSpace.account.accessToken!, rootState.TimelineSpace.account.baseURL + '/api/v2')
const res: Response = await client.get('/search', { q: word })
- commit(MUTATION_TYPES.APPEND_FILTERED_HASHTAGS, res.data.hashtags)
if (res.data.hashtags.length === 0) throw new Error('Empty')
- ipcRenderer.send('insert-cache-hashtags', res.data.hashtags)
+ commit(MUTATION_TYPES.APPEND_FILTERED_HASHTAGS, res.data.hashtags.map(tag => tag.name))
+ ipcRenderer.send('insert-cache-hashtags', res.data.hashtags.map(tag => tag.name))
commit(MUTATION_TYPES.CHANGE_OPEN_SUGGEST, true)
commit(MUTATION_TYPES.CHANGE_START_INDEX, start)
commit(MUTATION_TYPES.CHANGE_MATCH_WORD, word)