From 865b41114060765308d560181f4996c0aa7a3e74 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 26 Mar 2021 01:06:44 +0300 Subject: refactor: move Service to lib/ --- src/containers/Service/ServiceList.tsx | 35 ---------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/containers/Service/ServiceList.tsx (limited to 'src/containers/Service/ServiceList.tsx') diff --git a/src/containers/Service/ServiceList.tsx b/src/containers/Service/ServiceList.tsx deleted file mode 100644 index f716b24..0000000 --- a/src/containers/Service/ServiceList.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { useContext } from 'react'; -import { useHistory, useLocation } from 'react-router-dom'; -import Page from '../Page'; -import ListTable from '../../components/ListTable'; -import hooks from '../../hooks/useAPIClient'; -import ServiceContext from './ServiceContext'; - -const ServiceList: React.FC = () => { - const service = useContext(ServiceContext); - const history = useHistory(); - const location = useLocation(); - const { data } = hooks[service.route].useList(location.search); - - const actions = service.actions || [{ - name: 'Добавить', - route: `/${service.route}/add${location.search}`, - }]; - - const handleRowClick = (index: number) => { - const item = data && data[index]; - const route = service.rowLink - ? service.rowLink(item) - : `/${service.route}/${item?._id}`; - - history.push(route); - }; - - return ( - - - - ); -}; - -export default ServiceList; -- cgit v1.2.3