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.

cache.js 985B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. (function () {
  5. 'use strict';
  6. angular.module('luticateAuth')
  7. .factory('luticateAuthCache', ['localStorageService', function (localStorageService) {
  8. var luticateAuthCache = {};
  9. luticateAuthCache.setUser = function(user)
  10. {
  11. localStorageService.set('lu_user', user);
  12. };
  13. luticateAuthCache.getUser = function()
  14. {
  15. return localStorageService.get('lu_user');
  16. };
  17. luticateAuthCache.getToken = function()
  18. {
  19. var user = luticateAuthCache.getUser();
  20. if (user == null) {
  21. return null;
  22. }
  23. return user.Token;
  24. };
  25. luticateAuthCache.removeUser = function()
  26. {
  27. localStorageService.remove('lu_user');
  28. };
  29. return luticateAuthCache;
  30. }]);
  31. })();