mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-04 22:50:40 +08:00
feat: redirect to original page after login (#5604)
This commit is contained in:
parent
fff9954da2
commit
ae19eaa76a
@ -76,9 +76,8 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
|||||||
isUserFetching: false,
|
isUserFetching: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isLoggedIn) {
|
if (!isLoggedIn) {
|
||||||
history.push(ROUTES.LOGIN);
|
history.push(ROUTES.LOGIN, { from: pathname });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -163,8 +163,15 @@ function Login({
|
|||||||
response.payload.accessJwt,
|
response.payload.accessJwt,
|
||||||
response.payload.refreshJwt,
|
response.payload.refreshJwt,
|
||||||
);
|
);
|
||||||
|
if (history?.location?.state) {
|
||||||
|
const historyState = history?.location?.state as any;
|
||||||
|
|
||||||
|
if (historyState?.from) {
|
||||||
|
history.push(historyState?.from);
|
||||||
|
} else {
|
||||||
history.push(ROUTES.APPLICATION);
|
history.push(ROUTES.APPLICATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
notifications.error({
|
notifications.error({
|
||||||
message: response.error || t('unexpected_error'),
|
message: response.error || t('unexpected_error'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user