Guest User

Untitled

a guest
Apr 16th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. export function postLoginDetails(username, password, token) {
  2. const url = ENV.host + "/login";
  3.  
  4. return axios({
  5. method: 'post',
  6. url: url,
  7. withCredentials: true,
  8. headers: {
  9. "X-CSRFToken": token
  10. },
  11. data: {
  12. username: username,
  13. password: password,
  14. },
  15. responseType: 'json'
  16. }).catch(e => console.log(e))
  17. }
  18.  
  19. postLoginDetails(username, password, this.token).then((res) => {
  20. if (res.data.success) {
  21. this.isAuthenticated.set(true)
  22. cb();
  23. } else {
  24. this.error.set(true);
  25. this.errorText = observable('Fehler aufgetreten');
  26. this.name = observable('');
  27. }
  28. this.loginLoading.set(false);
  29. })
Add Comment
Please, Sign In to add comment