Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $http.post(API_URL + 'login', {
- username: $scope.username,
- password: $scope.password
- }, {
- cache: false,
- headers: {"Content-Type": "application/x-www-form-urlencoded"},
- withCredentials: true,
- transformRequest: function (obj) {
- var str = [];
- for (var p in obj)
- str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
- return str.join("&");
- }
- }).then(function (response) {
- if (response.data.status == 'success') {
- $localStorage.login.token = response.data.data;
- } else {
- $rootScope.showError($scope, response.data.data);
- $rootScope.hideLoad();
- }
- $rootScope.hideLoad();
- }).catch(function (error) {
- $rootScope.showError($scope, error.statusText);
- $rootScope.hideLoad();
- });
Add Comment
Please, Sign In to add comment