Guest User

Untitled

a guest
Jan 13th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <UserProvider value={{
  2. loggedIn: this.state.loggedIn,
  3. actions: {
  4. logIn: event => {
  5. this.setState({ loggedIn: true })
  6. }
  7. }
  8. }}>
  9. <Route path='/' component={Login} />
  10. </UserProvider>
  11.  
  12. requestAuth = () => {
  13. axios({
  14. method: 'post',
  15. url: process.env.REACT_APP_API_AUTH,
  16. data: {
  17. username: 'test',
  18. password: 'test'
  19. }
  20. })
  21. .then(
  22. (response) => {
  23. console.log(response)
  24. this.setState({
  25. feedback: "Alright, welcome back! I'm gonna log you in!"
  26. }, this.setLoginstate)
  27. }
  28. )
  29. .catch(
  30. (error) => {
  31. console.log(error)
  32. this.setState({
  33. feedback: "Sorry, I think your e-mail or password is incorrect. Wanna try again?"
  34. })
  35. }
  36. );
  37.  
  38. }
Add Comment
Please, Sign In to add comment