Guest User

Untitled

a guest
Mar 22nd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. $http.post(API_URL + 'login', {
  2. username: $scope.username,
  3. password: $scope.password
  4. }, {
  5. cache: false,
  6. headers: {"Content-Type": "application/x-www-form-urlencoded"},
  7. withCredentials: true,
  8. transformRequest: function (obj) {
  9. var str = [];
  10. for (var p in obj)
  11. str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  12. return str.join("&");
  13. }
  14. }).then(function (response) {
  15. if (response.data.status == 'success') {
  16. $localStorage.login.token = response.data.data;
  17.  
  18. } else {
  19. $rootScope.showError($scope, response.data.data);
  20. $rootScope.hideLoad();
  21. }
  22. $rootScope.hideLoad();
  23. }).catch(function (error) {
  24. $rootScope.showError($scope, error.statusText);
  25. $rootScope.hideLoad();
  26. });
Add Comment
Please, Sign In to add comment