debug cookieHandler

update_chat
adb 4 years ago
parent a2479875d1
commit 6e429193f5

@ -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)
});
} }
} }

@ -50,7 +50,7 @@ export default {
userId: this.user, userId: this.user,
accessToken: token accessToken: token
}); });
cookie.expires(15); cookie.setExpire(15);
cookie.store(); cookie.store();
this.$router.push('/rooms/'); this.$router.push('/rooms/');
}); });

Loading…
Cancel
Save