Skip to content

Commit

Permalink
Merge pull request #133 from lucyjemutai/fix-login
Browse files Browse the repository at this point in the history
fix re-direct after login
  • Loading branch information
lucyjemutai authored May 23, 2024
2 parents 882443a + 2558a3b commit d2d86f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pages/auth/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions utilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */,
});
Expand All @@ -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";
}
Expand Down

0 comments on commit d2d86f2

Please sign in to comment.