diff --git a/src/Login/api.ts b/src/Login/api.ts index 5392cd4..fa25f41 100644 --- a/src/Login/api.ts +++ b/src/Login/api.ts @@ -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); } } diff --git a/src/cookie.ts b/src/cookie.ts index c809418..8a3cb6e 100644 --- a/src/cookie.ts +++ b/src/cookie.ts @@ -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) {