diff --git a/src/component/product/settingsTab/URLConfiguration.jsx b/src/component/product/settingsTab/URLConfiguration.jsx index 658964d..4857da3 100644 --- a/src/component/product/settingsTab/URLConfiguration.jsx +++ b/src/component/product/settingsTab/URLConfiguration.jsx @@ -1,19 +1,19 @@ -import { Form, Formik } from "formik"; +import {Form, Formik} from "formik"; import * as Yup from "yup"; -import { useMutation } from '@tanstack/react-query'; -import { setExternalURL } from '../../../services/services'; +import {useMutation} from '@tanstack/react-query'; +import {setExternalURL} from '../../../services/services'; const validationSchema = Yup.object().shape({ - url: Yup.string().required("URL is required").matches(/^https?:\/\/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+\.[a-zA-Z]+/, 'Must be like: https://example.mysite.com'), - }) + url: Yup.string().required("URL is required").matches(/^https?:\/\/[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+\.[a-zA-Z]+/, 'Must be like: https://example.mysite.com'), +}) - const initialValues = { +const initialValues = { url: '', - }; +}; const URLConfiguration = ({productData}) => { - let defaultUrl= 'https://'+productData?.internal_url + let defaultUrl = 'https://' + productData?.internal_url // API to set url const setURL = useMutation({ @@ -21,13 +21,13 @@ const URLConfiguration = ({productData}) => { return setExternalURL(fields) }, onSuccess: (res) => { - if(res.data.resultCode != '0'){ + if (res.data.resultCode != '0') { // throw({message: res?.data?.resultDescription}) throw({message: 'Something went wrong!'}) } }, onSettled: () => { - setTimeout(()=>{ + setTimeout(() => { setURL.reset() }, 3000) } @@ -50,17 +50,16 @@ const URLConfiguration = ({productData}) => {
-

Default URL

+

{defaultUrl}

-
-
- {/**/} - -
- {/**/} -
+ {/*
*/} + {/*
*/} + {/* /!**!/*/} + {/* */} + {/*
*/} + {/*
*/}
{ onSubmit={handleSubmit} > {(props) => { - return ( -
-
-
-
-

Set your own URL

+ return ( + +
+
+
+

Set your own URL

+
-
-
-
- - +
+
+ + +
+
+ +
- -
- {setURL.error && -
-

{setURL.error.message}

-
- } + {setURL.error && +
+

{setURL.error.message}

+
+ } - {setURL.isSuccess && -
-

{'Completed successfully'}

-
- } -
- - ); + {setURL.isSuccess && +
+

{'Completed successfully'}

+
+ } +
+ + ); }}