diff --git a/pages/auth/login.js b/pages/auth/login.js index da7e14e..71ba527 100755 --- a/pages/auth/login.js +++ b/pages/auth/login.js @@ -62,9 +62,9 @@ function Login() { type: "success", message: "Login successful", }); - // setTimeout(() => { - // router.push('/user/', undefined, { unstable_skipClientCache: true }) - // }, 2000); + setTimeout(() => { + router.push('/user/', undefined, { unstable_skipClientCache: true }) + }, 2000); } else { setStatus({ ...data, diff --git a/utilities/index.js b/utilities/index.js index f572740..054f9fd 100755 --- a/utilities/index.js +++ b/utilities/index.js @@ -69,7 +69,7 @@ export const doLogin = async (username, password, rtr) => { .then((data) => { if (data?.username) { // store user in cookie - Cookies.set("user", JSON.stringify(userData), { + Cookies.set("user", JSON.stringify(data?.username), { path: "/", expires: 7 /* additional options */, }); @@ -78,7 +78,7 @@ export const doLogin = async (username, password, rtr) => { if (rtr) { rtr.push("/user", undefined, { unstable_skipClientCache: true, - }); + }); } else { window.location.pathname = "/user"; }