23 lines
621 B
JavaScript
23 lines
621 B
JavaScript
/**
|
|
* Helper service for working with cookies.
|
|
*/
|
|
angular.module('quay').factory('CookieService', ['$cookies', '$cookieStore', function($cookies, $cookieStore) {
|
|
var cookieService = {};
|
|
cookieService.putPermanent = function(name, value) {
|
|
document.cookie = escape(name) + "=" + escape(value) + "; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
|
|
};
|
|
|
|
cookieService.putSession = function(name, value) {
|
|
$cookies[name] = value;
|
|
};
|
|
|
|
cookieService.clear = function(name) {
|
|
$cookies[name] = '';
|
|
};
|
|
|
|
cookieService.get = function(name) {
|
|
return $cookies[name];
|
|
};
|
|
|
|
return cookieService;
|
|
}]);
|