Advertisement
Guest User

Untitled

a guest
Mar 21st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. fetch(`${keys.api}/login`,
  2. {
  3. method: 'POST',
  4. body: JSON.stringify({
  5. username: this.state.username,
  6. password: this.state.password,
  7. }),
  8. headers: {
  9. 'Accept': 'application/json',
  10. 'Content-Type': 'application/json',
  11. },
  12.  
  13. }
  14. ).then((response) => {
  15. if(response._bodyText == 'success') {
  16. this.props.resetToRoute({
  17. name: '主页',
  18. component: Main,
  19. hideNavigationBar: true,
  20. });
  21. } else {
  22. this.cancelLogin();
  23. }
  24. }).catch((error) => {
  25. console.warn(error);
  26. this.cancelLogin();
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement