From 5f1bf64ed38fdda9143b75f0ab847eebe55eaaaa Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 20 Mar 2021 17:52:29 +0300 Subject: feat: allow extending Services --- src/containers/Service/ServiceList.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/containers/Service/ServiceList.tsx') diff --git a/src/containers/Service/ServiceList.tsx b/src/containers/Service/ServiceList.tsx index b7054eb..7d30c14 100644 --- a/src/containers/Service/ServiceList.tsx +++ b/src/containers/Service/ServiceList.tsx @@ -11,7 +11,15 @@ const ServiceList: React.FC = () => { const history = useHistory(); const { data } = hooks[service.route].useList(); - const actions = [{ name: 'Добавить', route: `/${service.route}/add` }]; + const actions = [ + ...( + service.actions?.map(action => ({ + ...action, + route: `/${service.route}/${action.route}`, + })) || [] + ), + { name: 'Добавить', route: `/${service.route}/add` }, + ]; const handleRowClick = (index: number) => { const item = data && data[index]; -- cgit v1.2.3