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
|
return accounts
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('insert-cache-accounts', (event: IpcMainEvent, obj: InsertAccountCache) => {
|
ipcMain.handle('insert-cache-accounts', async (_: IpcMainInvokeEvent, obj: InsertAccountCache) => {
|
||||||
const { ownerID, accts } = obj
|
const { ownerID, accts } = obj
|
||||||
|
Promise.all(
|
||||||
accts.map(async acct => {
|
accts.map(async acct => {
|
||||||
await accountCache.insertAccount(ownerID, acct).catch(err => console.error(err))
|
await accountCache.insertAccount(ownerID, acct).catch(err => console.error(err))
|
||||||
})
|
})
|
||||||
event.sender.send('response-insert-cache-accounts')
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Application control
|
// Application control
|
||||||
|
|
|
@ -176,7 +176,7 @@ const actions: ActionTree<StatusState, RootState> = {
|
||||||
MUTATION_TYPES.APPEND_FILTERED_ACCOUNTS,
|
MUTATION_TYPES.APPEND_FILTERED_ACCOUNTS,
|
||||||
res.data.map(account => account.acct)
|
res.data.map(account => account.acct)
|
||||||
)
|
)
|
||||||
win.ipcRenderer.send('insert-cache-accounts', {
|
await win.ipcRenderer.invoke('insert-cache-accounts', {
|
||||||
ownerID: rootState.TimelineSpace.account._id!,
|
ownerID: rootState.TimelineSpace.account._id!,
|
||||||
accts: res.data.map(a => a.acct)
|
accts: res.data.map(a => a.acct)
|
||||||
} as InsertAccountCache)
|
} as InsertAccountCache)
|
||||||
|
|
Loading…
Reference in New Issue