|
|
@ -2,6 +2,8 @@ export class cookieHandler {
|
|
|
|
constructor() {
|
|
|
|
constructor() {
|
|
|
|
this.cookies = {};
|
|
|
|
this.cookies = {};
|
|
|
|
this.reload();
|
|
|
|
this.reload();
|
|
|
|
|
|
|
|
this.expires = undefined;
|
|
|
|
|
|
|
|
this.SameSite = 'Strict';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getCookies(){
|
|
|
|
getCookies(){
|
|
|
|
return this.cookies;
|
|
|
|
return this.cookies;
|
|
|
@ -26,7 +28,7 @@ export class cookieHandler {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
store(){
|
|
|
|
store(){
|
|
|
|
Object.keys(this.cookies).forEach(key => {
|
|
|
|
Object.keys(this.cookies).forEach(key => {
|
|
|
|
document.cookie = `${key}=${this.cookies[key]};`;
|
|
|
|
document.cookie = `${key}=${this.cookies[key]}; expires=${this.expires}; SameSite=${this.SameSite}; Secure;`;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
console.log('cookie stored');
|
|
|
|
console.log('cookie stored');
|
|
|
|
console.log(this.cookies);
|
|
|
|
console.log(this.cookies);
|
|
|
@ -38,9 +40,7 @@ export class cookieHandler {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return string;
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expires(days){
|
|
|
|
setExpire(days){
|
|
|
|
this.setCookie({
|
|
|
|
this.expires = new Date(Date.now() + 86400 * 10000 * days);
|
|
|
|
expires: new Date(Date.now() + 86400 * 10000 * days)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|