From a7e97f33ae31dd2be1d7c04ecb8f2439ffebf921 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 21 Mar 2021 13:10:32 +0300
Subject: feat: add useQuery hook

---
 src/containers/Service/ServiceItem.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/containers/Service/ServiceItem.tsx')

diff --git a/src/containers/Service/ServiceItem.tsx b/src/containers/Service/ServiceItem.tsx
index 22357c7..f833227 100644
--- a/src/containers/Service/ServiceItem.tsx
+++ b/src/containers/Service/ServiceItem.tsx
@@ -4,6 +4,7 @@ import { Formik } from 'formik';
 import _ from 'lodash';
 import Page, { Action } from '../Page';
 import hooks from '../../hooks/useAPIClient';
+import useQuery from '../../hooks/useQuery';
 import { post, patch, del } from '../../requests';
 import ServiceContext from './ServiceContext';
 
@@ -14,6 +15,7 @@ interface Params {
 const ServiceItem: React.FC = () => {
   const service = useContext(ServiceContext);
   const history = useHistory();
+  const query = useQuery();
   const { id } = useParams<Params>();
   const { data: item, mutate } = hooks[service.route].useItem(id);
 
@@ -44,7 +46,7 @@ const ServiceItem: React.FC = () => {
     >
       {(!id || item) && (
         <Formik
-          initialValues={_.defaults(item, service.default)}
+          initialValues={_.defaults(item, query, service.default)}
           onSubmit={onSubmit}
           children={service.Form}
         />
-- 
cgit v1.2.3

