Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <UserProvider value={{
- loggedIn: this.state.loggedIn,
- actions: {
- logIn: event => {
- this.setState({ loggedIn: true })
- }
- }
- }}>
- <Route path='/' component={Login} />
- </UserProvider>
- requestAuth = () => {
- axios({
- method: 'post',
- url: process.env.REACT_APP_API_AUTH,
- data: {
- username: 'test',
- password: 'test'
- }
- })
- .then(
- (response) => {
- console.log(response)
- this.setState({
- feedback: "Alright, welcome back! I'm gonna log you in!"
- }, this.setLoginstate)
- }
- )
- .catch(
- (error) => {
- console.log(error)
- this.setState({
- feedback: "Sorry, I think your e-mail or password is incorrect. Wanna try again?"
- })
- }
- );
- }
Add Comment
Please, Sign In to add comment