forked from OpenServer/OpenAuth_views
Remove async from finish and add path to setCookie
This commit is contained in:
parent
03a7f76b43
commit
7d10fdae30
@ -101,7 +101,7 @@ const Api = {
|
|||||||
return {};
|
return {};
|
||||||
}).catch(error => ({ error: error.message }))
|
}).catch(error => ({ error: error.message }))
|
||||||
},
|
},
|
||||||
async finish() {
|
finish() {
|
||||||
let d = new Date()
|
let d = new Date()
|
||||||
d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000)); //Keep the username 30 days
|
d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000)); //Keep the username 30 days
|
||||||
setCookie("username", this.username, d.toUTCString());
|
setCookie("username", this.username, d.toUTCString());
|
||||||
@ -120,7 +120,7 @@ const Api = {
|
|||||||
else
|
else
|
||||||
red = state
|
red = state
|
||||||
}
|
}
|
||||||
window.location.href = red;
|
setTimeout(() => window.location.href = red, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
export function setCookie(cname: string, cvalue: string, exdate: string) {
|
export function setCookie(cname: string, cvalue: string, exdate: string) {
|
||||||
const expires = exdate ? `;expires=${exdate}` : "";
|
const expires = exdate ? `;expires=${exdate}` : "";
|
||||||
document.cookie = `${cname}=${cvalue}${expires}`
|
document.cookie = `${cname}=${cvalue}${expires};path=/;`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCookie(cname: string) {
|
export function getCookie(cname: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user