Remove async from finish and add path to setCookie

This commit is contained in:
Fabian Stamm 2019-08-28 10:02:31 +02:00
parent 03a7f76b43
commit 7d10fdae30
2 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ const Api = {
return {};
}).catch(error => ({ error: error.message }))
},
async finish() {
finish() {
let d = new Date()
d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000)); //Keep the username 30 days
setCookie("username", this.username, d.toUTCString());
@ -120,7 +120,7 @@ const Api = {
else
red = state
}
window.location.href = red;
setTimeout(() => window.location.href = red, 200);
}
}

View File

@ -1,6 +1,6 @@
export function setCookie(cname: string, cvalue: string, exdate: string) {
const expires = exdate ? `;expires=${exdate}` : "";
document.cookie = `${cname}=${cvalue}${expires}`
document.cookie = `${cname}=${cvalue}${expires};path=/;`
}
export function getCookie(cname: string) {