|
|
|
@@ -8,12 +8,12 @@ import queryKeys from '../../services/queryKeys';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const linksValidationSchema = Yup.object().shape({
|
|
|
|
|
// facebook_url: Yup.string().required("facebook is required"),
|
|
|
|
|
// twitter_url: Yup.string().required("twitter is required"),
|
|
|
|
|
// blogger_url: Yup.string().required("blog is required"),
|
|
|
|
|
// google_url: Yup.string().required("google is required"),
|
|
|
|
|
// linked_url: Yup.string().required("linkedin is required"),
|
|
|
|
|
// website_url: Yup.string().required("website is required"),
|
|
|
|
|
facebook_url: Yup.string().matches(/^https:\/\/.+/,"URL must start with https://"),
|
|
|
|
|
twitter_url: Yup.string().matches(/^https:\/\/.+/,"URL must start with https://"),
|
|
|
|
|
blogger_url: Yup.string().matches(/^https:\/\/.+/,"URL must start with https://"),
|
|
|
|
|
google_url: Yup.string().matches(/^https:\/\/.+/,"URL must start with https://"),
|
|
|
|
|
linked_url: Yup.string().matches(/^https:\/\/.+/,"URL must start with https://"),
|
|
|
|
|
website_url: Yup.string().matches(/^https:\/\/.+/,"URL must start with https://"),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default function LinksForm({data}) {
|
|
|
|
@@ -73,10 +73,10 @@ export default function LinksForm({data}) {
|
|
|
|
|
let reqData = {
|
|
|
|
|
token: localStorage.getItem('token'), // USER TOKEN
|
|
|
|
|
uid: localStorage.getItem('uid'), // USER UID
|
|
|
|
|
...infoToUpdate
|
|
|
|
|
url_list: {...infoToUpdate}
|
|
|
|
|
}
|
|
|
|
|
console.log(reqData)
|
|
|
|
|
// updateLinksMutation.mutate(reqData)
|
|
|
|
|
// console.log(reqData)
|
|
|
|
|
updateLinksMutation.mutate(reqData)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
@@ -90,31 +90,31 @@ export default function LinksForm({data}) {
|
|
|
|
|
return (
|
|
|
|
|
<Form className=''>
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
<label htmlFor="fb">Facebook URL: {(props.errors.facebook_url && props.touched.facebook_url) && <span className="text-danger">*</span>}</label>
|
|
|
|
|
<label htmlFor="fb">Facebook URL: {(props.errors.facebook_url && props.touched.facebook_url) && <span className="text-danger">{props.errors.facebook_url}</span>}</label>
|
|
|
|
|
<input type="text" className="form-control" name="facebook_url" value={props.values?.facebook_url} onChange={props.handleChange} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
<label htmlFor="tr">Twitter URL: {(props.errors.twitter_url && props.touched.twitter_url) && <span className="text-danger">*</span>}</label>
|
|
|
|
|
<label htmlFor="tr">Twitter URL: {(props.errors.twitter_url && props.touched.twitter_url) && <span className="text-danger">{props.errors.twitter_url}</span>}</label>
|
|
|
|
|
<input type="text" className="form-control" name="twitter_url" value={props.values?.twitter_url} onChange={props.handleChange} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
<label htmlFor="br">Blogger URL: {(props.errors.blogger_url && props.touched.blogger_url) && <span className="text-danger">*</span>}</label>
|
|
|
|
|
<label htmlFor="br">Blogger URL: {(props.errors.blogger_url && props.touched.blogger_url) && <span className="text-danger">{props.errors.blogger_url}</span>}</label>
|
|
|
|
|
<input type="text" className="form-control" name="blogger_url" value={props.values?.blogger_url} onChange={props.handleChange} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
<label htmlFor="go">Google+ URL: {(props.errors.google_url && props.touched.google_url) && <span className="text-danger">*</span>}</label>
|
|
|
|
|
<label htmlFor="go">Google+ URL: {(props.errors.google_url && props.touched.google_url) && <span className="text-danger">{props.errors.google_url}</span>}</label>
|
|
|
|
|
<input type="text" className="form-control" name="google_url" value={props.values?.google_url} onChange={props.handleChange} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
<label htmlFor="li">LinkedIn URL: {(props.errors.linked_url && props.touched.linked_url) && <span className="text-danger">*</span>}</label>
|
|
|
|
|
<label htmlFor="li">LinkedIn URL: {(props.errors.linked_url && props.touched.linked_url) && <span className="text-danger">{props.errors.linked_url}</span>}</label>
|
|
|
|
|
<input type="text" className="form-control" name="linked_url" value={props.values?.linked_url} onChange={props.handleChange} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-group">
|
|
|
|
|
<label htmlFor="we">Website URL: {(props.errors.website_url && props.touched.website_url) && <span className="text-danger">*</span>}</label>
|
|
|
|
|
<label htmlFor="we">Website URL: {(props.errors.website_url && props.touched.website_url) && <span className="text-danger">{props.errors.website_url}</span>}</label>
|
|
|
|
|
<input type="text" className="form-control" name="website_url" value={props.values?.website_url} onChange={props.handleChange} />
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{textAlign: "right"}}>
|
|
|
|
@@ -137,7 +137,7 @@ export default function LinksForm({data}) {
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="modal-body">
|
|
|
|
|
<h5 className="text-center" style={{fontSize: '18px'}}>Are you sure, you want to update? gg</h5>
|
|
|
|
|
<h5 className="text-center" style={{fontSize: '18px'}}>Are you sure, you want to update?</h5>
|
|
|
|
|
{(updateLinksMutation.error || updateLinksMutation.isSuccess) && (
|
|
|
|
|
<div className="col-12">
|
|
|
|
|
<p className={`p-2 text-center ${updateLinksMutation.isSuccess ? 'text-success' : 'text-danger'}`}>
|
|
|
|
|