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.
19 lines
456 B
19 lines
456 B
export default class Cookie{
|
|
static get(name){
|
|
let v = window.document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
|
|
|
return v ? v[2] : null;
|
|
}
|
|
|
|
static set(name, value, days = 1){
|
|
let d = new Date;
|
|
|
|
d.setTime(d.getTime() + 24*60*60*1000*days);
|
|
|
|
window.document.cookie = name + "=" + value + ";path=/;expires=" + d.toGMTString();
|
|
}
|
|
static delete(name){
|
|
this.set(name, '', -1);
|
|
}
|
|
}
|