diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-20 17:52:29 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-20 17:52:29 +0300 |
commit | 5f1bf64ed38fdda9143b75f0ab847eebe55eaaaa (patch) | |
tree | 92ca75a3eb1df3b753566dc6ca148360d6e0d06b /src/containers/Service/ServiceList.tsx | |
parent | 839c9ccc0e12b7d15611df72baf9acaea19e8480 (diff) | |
download | commercel-ui-5f1bf64ed38fdda9143b75f0ab847eebe55eaaaa.tar.gz |
feat: allow extending Services
Diffstat (limited to 'src/containers/Service/ServiceList.tsx')
-rw-r--r-- | src/containers/Service/ServiceList.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
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]; |