Update ProfileForm.js

This commit is contained in:
Andrean
2023-05-08 17:06:27 +00:00
committed by GitHub
parent ff13ec05d8
commit cb88409727
@@ -4,11 +4,6 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createProfile, getCurrentProfile } from '../../actions/profile';
/*
NOTE: declare initialState outside of component
so that it doesn't trigger a useEffect
we can then safely use this to construct our profileData
*/
const initialState = {
company: '',
website: '',
@@ -78,16 +73,11 @@ const ProfileForm = ({
setFormData({ ...formData, [e.target.name]: e.target.value });
const onSubmit = (e) => {
<<<<<<< HEAD
const editing = profile ? true : false;
e.preventDefault();
createProfile(formData, editing).then(() => {
if (!editing) navigate('/dashboard');
});
=======
e.preventDefault();
createProfile(formData, navigate, profile ? true : false);
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
};
return (
@@ -281,8 +271,5 @@ const mapStateToProps = (state) => ({
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
ProfileForm
<<<<<<< HEAD
);
=======
);
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb