refactor: Use invoke for ipc to insert cache hashtags
This commit is contained in:
parent
d2ca00354b
commit
9308a27f64
|
@ -1030,11 +1030,12 @@ ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {
|
||||||
return tags
|
return tags
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('insert-cache-hashtags', (event: IpcMainEvent, tags: Array<string>) => {
|
ipcMain.handle('insert-cache-hashtags', async (_: IpcMainInvokeEvent, tags: Array<string>) => {
|
||||||
|
await Promise.all(
|
||||||
tags.map(async name => {
|
tags.map(async name => {
|
||||||
await hashtagCache.insertHashtag(name).catch(err => console.error(err))
|
await hashtagCache.insertHashtag(name).catch(err => console.error(err))
|
||||||
})
|
})
|
||||||
event.sender.send('response-insert-cache-hashtags')
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('get-cache-accounts', async (event: IpcMainEvent, ownerID: string) => {
|
ipcMain.on('get-cache-accounts', async (event: IpcMainEvent, ownerID: string) => {
|
||||||
|
|
|
@ -223,7 +223,7 @@ const actions: ActionTree<StatusState, RootState> = {
|
||||||
MUTATION_TYPES.APPEND_FILTERED_HASHTAGS,
|
MUTATION_TYPES.APPEND_FILTERED_HASHTAGS,
|
||||||
res.data.hashtags.map(tag => tag.name)
|
res.data.hashtags.map(tag => tag.name)
|
||||||
)
|
)
|
||||||
win.ipcRenderer.send(
|
await win.ipcRenderer.invoke(
|
||||||
'insert-cache-hashtags',
|
'insert-cache-hashtags',
|
||||||
res.data.hashtags.map(tag => tag.name)
|
res.data.hashtags.map(tag => tag.name)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue