Update ProfileForm.js
This commit is contained in:
@@ -4,11 +4,6 @@ import PropTypes from 'prop-types';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { createProfile, getCurrentProfile } from '../../actions/profile';
|
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 = {
|
const initialState = {
|
||||||
company: '',
|
company: '',
|
||||||
website: '',
|
website: '',
|
||||||
@@ -78,16 +73,11 @@ const ProfileForm = ({
|
|||||||
setFormData({ ...formData, [e.target.name]: e.target.value });
|
setFormData({ ...formData, [e.target.name]: e.target.value });
|
||||||
|
|
||||||
const onSubmit = (e) => {
|
const onSubmit = (e) => {
|
||||||
<<<<<<< HEAD
|
|
||||||
const editing = profile ? true : false;
|
const editing = profile ? true : false;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
createProfile(formData, editing).then(() => {
|
createProfile(formData, editing).then(() => {
|
||||||
if (!editing) navigate('/dashboard');
|
if (!editing) navigate('/dashboard');
|
||||||
});
|
});
|
||||||
=======
|
|
||||||
e.preventDefault();
|
|
||||||
createProfile(formData, navigate, profile ? true : false);
|
|
||||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -281,8 +271,5 @@ const mapStateToProps = (state) => ({
|
|||||||
|
|
||||||
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
|
export default connect(mapStateToProps, { createProfile, getCurrentProfile })(
|
||||||
ProfileForm
|
ProfileForm
|
||||||
<<<<<<< HEAD
|
|
||||||
);
|
);
|
||||||
=======
|
|
||||||
);
|
|
||||||
>>>>>>> cc38df43629d64ca77f694c971a13a026b3afcfb
|
|
||||||
|
|||||||
Reference in New Issue
Block a user