Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('app.services.api_login', [])
- .factory('loginApi', function($http, $q, CONFIG) {
- return function(email, password) {
- var promise = $http({
- method: 'POST',
- url: CONFIG.login_url,
- data: {
- username: email,
- password: password
- },
- headers: {'Content-Type': 'application/json'}
- }).
- then(function(response){
- if (typeof response.data === 'object') {
- return response;
- } else {
- return $q.reject(response);
- }
- }, function(error){
- return $q.reject(error);
- });
- return promise;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement