Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*jshint esversion: 6 */
- import React from "react";
- import { Link } from 'react-router-dom';
- import EditName from "./EditName";
- import EditSurname from "./EditSurname"
- import EditInfo from "./EditInfo"
- import EditEmail from "./EditEmail"
- import axios from 'axios'
- class EditProfile extends React.Component {
- handleSubmit = event => {
- this.send()
- };
- send() {
- axios(
- {
- headers: {
- 'Access-Control-Allow-Origin': '*'
- },
- method: 'POST',
- url: 'http://localhost:8080/api/editprofile',
- data: {
- 'information': this.information.value,
- 'name': this.name.value,
- 'surname': this.surname.value,
- 'email': this.email.value,
- }
- }
- ).then((response) => {
- if (response.data.result === "good") {
- }
- else {
- console.log(response);
- document.getElementById("error").innerHTML = response.data.result;
- }
- },
- (err) => {
- console.log(err);
- });
- return false;
- }
- constructor(props) {
- super(props);
- }
- render() {
- return (
- <div>
- <EditInfo ref={(input) => {
- this.information = input
- }}/>
- <br/>
- <EditName ref={(input) => {
- this.name = input
- }}/>
- <br/>
- <EditSurname ref={(input) => {
- this.surname = input
- }}/>
- <br/>
- <EditEmail ref={(input) => {
- this.email = input
- }}/>
- <br/>
- <Link className="btn btn-outline-success my-2 my-sm-0" to="editpassword">Хотите изменить пароль?</Link>
- <br/>
- <br/>
- <Link className="btn btn-lg btn-primary btn-block" to='/profile' onClick={this.handleSubmit}>Сохранить</Link>
- </div>
- );
- };
- }
- export default EditProfile;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement