Skip to content

Commit 1442738

Browse files
committed
fix: redirect correctly to the page which was targeted after login in
1 parent e5700c0 commit 1442738

File tree

1 file changed

+4
-1
lines changed
  • web/src/core/usecases/userAuthentication

1 file changed

+4
-1
lines changed

web/src/core/usecases/userAuthentication/thunks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ export const protectedThunks = {
2020

2121
export const thunks = {
2222
login: () => async () => {
23-
window.location.href = `${apiUrl}/auth/login`;
23+
const currentUrl =
24+
window.location.pathname + window.location.search + window.location.hash;
25+
const redirectUrl = encodeURIComponent(`${window.location.origin}${currentUrl}`);
26+
window.location.href = `${apiUrl}/auth/login?redirectUrl=${redirectUrl}`;
2427
},
2528
logout: () => async () => {
2629
window.location.href = `${apiUrl}/auth/logout`;

0 commit comments

Comments
 (0)