Created
March 3, 2016 13:10
-
-
Save andrewjmead/4ea1c767f1da42d937ba to your computer and use it in GitHub Desktop.
Marcus - Export User
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function loginUser(props) { | |
| const request = axios.post(`/users/login`, props); | |
| return request.then((response) => { | |
| var token = response.headers.auth; | |
| localStorage.setItem('token', token); //The user's token is taken from the reponse and set in local storage as 'token' | |
| console.log('Token: ', localStorage.getItem('token')); | |
| }, (response) => { | |
| console.log("Error block in loginUser has been reached"); | |
| throw new Error(response.status); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment