acha-framework
Version:
is a modular framework on both client (angular.js) and server (node.js) side, it provides security, orm, ioc, obfuscation and ...
22 lines • 685 B
JavaScript
(function ($, angular, underscore, window, document, undefined) {
'use strict';
angular.module('frontend.services').factory('identityService', [
'ipCookie',
function ($cookie) {
return {
accountPath: '/{0}/account',
setToken: function (userId, token) {
$cookie('userId', userId, { path: '/' });
$cookie('token', token, { path: '/' });
},
clearToken: function () {
$cookie.remove('userId', { path: '/' });
$cookie.remove('token', { path: '/' });
},
getToken: function () {
return $cookie('token');
}
};
}
]);
}(jQuery, angular, _, window, document));