Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. fetch(`${SERVER_URL}/api/signin`, {
  2. method: 'POST',
  3. mode: 'cors',
  4. body: JSON.stringify({username: email, password:password})})
  5. .then(response => {
  6. if (response.status === 200) {
  7. response.json().then(function (data) {
  8. localStorage.setItem('token', data.access_token);
  9. dispatch({type: AUTH_USER});
  10. browserHistory.push('/welcome');
  11. });
  12. }})}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement