Reuse
This commit is contained in:
parent
022ec12b1b
commit
8f99072552
|
@ -30,16 +30,7 @@ export async function find(ctx: Ctx<void, RowActionsResponse>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { actions } = rowActions
|
const { actions } = rowActions
|
||||||
const automations = await sdk.automations.find(
|
const automationNames = await sdk.rowActions.getNames(rowActions)
|
||||||
Object.values(actions).map(({ automationId }) => automationId)
|
|
||||||
)
|
|
||||||
const automationNames = automations.reduce<Record<string, string>>(
|
|
||||||
(names, a) => {
|
|
||||||
names[a._id] = a.name
|
|
||||||
return names
|
|
||||||
},
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
const result: RowActionsResponse = {
|
const result: RowActionsResponse = {
|
||||||
actions: Object.entries(actions).reduce<Record<string, RowActionResponse>>(
|
actions: Object.entries(actions).reduce<Record<string, RowActionResponse>>(
|
||||||
(acc, [key, action]) => ({
|
(acc, [key, action]) => ({
|
||||||
|
|
Loading…
Reference in New Issue