Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Account extends Component {
- constructor(props) {
- super(props);
- this.state = {
- id: this.props.match.params.id,
- name: '',
- email: '',
- password: '',
- link: ''
- }
- }
- componentDidMount() {
- console.log(this.state.id)
- // eslint-disable-next-line
- if (this.state.id === -1) {
- return
- }
- ApiService.fetchAccountById(this.state.id)
- .then(response => this.setState({
- item: {
- name: response.data.name,
- email: response.data.email,
- password: response.data.password,
- link: response.data.link
- }
- }))
- }
- render() {
- let {name, email, password, link, id} = this.state.item;
- return (
- <div>
- <h3>Account</h3>
- <div>{id}</div>
- <div>{name}</div>
- <div>{email}</div>
- <div>{password}</div>
- <div>{link}</div>
- </div>
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement