Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- axios.post('http://localhost:3000/api/v1/login', {
- email: this.state.email,
- password: this.state.password
- }, {
- headers: {
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Credentials": true,
- "Access-Control-Allow-Methods": "GET,HEAD,OPTIONS,POST,PUT,DELETE",
- "Access-Control-Allow-Headers": "",
- }
- })
- .then(function (response) { this.onloginSuccess(response) })
- .catch(function (error) { this.onLoginFail(error)});
- onloginSuccess = (response) => {
- console.log(response)
- this.setState({
- buttonDisable: false
- });
- sessionStorage.setItem('uuid', response.value.data.uuid)
- sessionStorage.setItem('bearertoken', response.value.data.bearertoken)
- this.props.history.push({ pathname: '/dashboard' })
- }
- onloginFail = (error) => {
- NotificationManager.error(error.response.data.message, 'Error!', 5000);
- this.setState({
- buttonDisable: false
- });
- }
- Uncaught (in promise) TypeError: Cannot read property 'onLoginFail' of undefined
- at eval (index.js?8a7d:95)
- index.js?8a7d:94 Uncaught (in promise) TypeError: Cannot read property 'onloginSuccess' of undefined
- at eval (index.js?8a7d:94)
Add Comment
Please, Sign In to add comment