added delete to story

This commit is contained in:
ari committed 2022-07-27 19:29:28 -04:00
1 parent f20eb271d9
commit 27314be9a8
1 file changed
+16 -1
@@ -117,7 +117,22 @@ export const Mocked: ComponentStory<typeof AutomationList> = (args) => {
[eid]: a.state,
});
}}
onTagUpdate={() => {}}
onTagUpdate={(tags, aid) => {
args.onTagUpdate(tags, aid);
const index = mockAutos.findIndex(
({ metadata }) => metadata.id === aid
);
if (index >= 0) {
setAutos([
...mockAutos.slice(0, index),
{
...mockAutos[index],
tags,
},
...mockAutos.slice(index + 1),
]);
}
}}
/>
</Page>
);