You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users.js 963B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. (function () {
  5. 'use strict';
  6. angular.module('luticateAuth')
  7. .factory('luticateAuthUsers', ['luticateRequest', '$q', 'luticateAuthCache',
  8. function(luticateRequest, $q, luticateAuthCache) {
  9. var luticateAuthUsers = {};
  10. luticateAuthUsers.login = function(data, promise)
  11. {
  12. var defer = $q.defer();
  13. luticateRequest.post("/api/luticate/users/login", data, null, promise)
  14. .then(function(data)
  15. {
  16. luticateAuthCache.setUser(data);
  17. defer.resolve(data);
  18. }, function(error)
  19. {
  20. luticateAuthCache.removeUser();
  21. defer.reject(error);
  22. });
  23. return defer.promise;
  24. };
  25. return luticateAuthUsers;
  26. }]);
  27. })();