From 7d10fdae30c6279f7e7688a0e7e0d177c450c431 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Wed, 28 Aug 2019 10:02:31 +0200 Subject: [PATCH] Remove async from finish and add path to setCookie --- src/Login/api.ts | 4 ++-- src/cookie.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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) {