Compare commits

...

1 Commits

Author SHA1 Message Date
rahulkeswani101
da44396c9c feat: redirect to original page after login 2024-07-30 11:09:59 +05:30
2 changed files with 9 additions and 3 deletions

View File

@@ -76,9 +76,8 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
isUserFetching: false,
},
});
if (!isLoggedIn) {
history.push(ROUTES.LOGIN);
history.push(ROUTES.LOGIN, { from: pathname });
}
};

View File

@@ -163,8 +163,15 @@ function Login({
response.payload.accessJwt,
response.payload.refreshJwt,
);
if (history?.location?.state) {
const historyState = history?.location?.state as any;
history.push(ROUTES.APPLICATION);
if (historyState?.from) {
history.push(historyState?.from);
} else {
history.push(ROUTES.APPLICATION);
}
}
} else {
notifications.error({
message: response.error || t('unexpected_error'),