examples/opta-mern-stack/client/src/components/edit.js
// This function will handle the submission.
This function will handle the submission.
This function will handle the submission .
onSubmit(e) {
    e.preventDefault();
    const newEditedperson = {
      person_name: this.state.person_name,
      person_position: this.state.person_position,
      person_level: this.state.person_level,
    };
    console.log(newEditedperson);
    const api_endpoint = Config.API_ENDPOINT;
    axios
      .post(
        api_endpoint + "/update/" + this.props.match.params.id,
        newEditedperson
      )
      .then((res) => console.log(res.data));
    this.props.history.push("/");
  }
onSubmit ( e ) { e . preventDefault ( ) ; const newEditedperson = { person_name : this . state . person_name , person_position : this . state . person_position , person_level : this . state . person_level , } ; console . log ( newEditedperson ) ; const api_endpoint = Config . API_ENDPOINT ; axios . post ( api_endpoint + "/update/" + this . props . match . params . id , newEditedperson ) . then ( ( res ) => console . log ( res . data ) ) ; this . props . history . push ( "/" ) ; }
This function will handle the submission.
This function will handle the submission .
// This will send a post request to update the data in the database.