refactor: Use invoke for ipc to insert cache accounts
This commit is contained in:
parent
81c0781dae
commit
ec3cb47c5d
|
@ -1043,12 +1043,13 @@ ipcMain.handle('get-cache-accounts', async (_: IpcMainInvokeEvent, ownerID: stri
|
|||
return accounts
|
||||
})
|
||||
|
||||
ipcMain.on('insert-cache-accounts', (event: IpcMainEvent, obj: InsertAccountCache) => {
|
||||
ipcMain.handle('insert-cache-accounts', async (_: IpcMainInvokeEvent, obj: InsertAccountCache) => {
|
||||
const { ownerID, accts } = obj
|
||||
Promise.all(
|
||||
accts.map(async acct => {
|
||||
await accountCache.insertAccount(ownerID, acct).catch(err => console.error(err))
|
||||
})
|
||||
event.sender.send('response-insert-cache-accounts')
|
||||
)
|
||||
})
|
||||
|
||||
// Application control
|
||||
|
|
|
@ -176,7 +176,7 @@ const actions: ActionTree<StatusState, RootState> = {
|
|||
MUTATION_TYPES.APPEND_FILTERED_ACCOUNTS,
|
||||
res.data.map(account => account.acct)
|
||||
)
|
||||
win.ipcRenderer.send('insert-cache-accounts', {
|
||||
await win.ipcRenderer.invoke('insert-cache-accounts', {
|
||||
ownerID: rootState.TimelineSpace.account._id!,
|
||||
accts: res.data.map(a => a.acct)
|
||||
} as InsertAccountCache)
|
||||
|
|
Loading…
Reference in New Issue