Skip to content

Commit 955082e

Browse files
committed
Replace setting href with .replace()
1 parent ba9ee88 commit 955082e

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/common/auth/AuthCallbackHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function useAuthCallback() {
4747
}
4848

4949
sessionStorage.removeItem(AUTH_FLOW_SESSION_KEY);
50-
window.location.href = forwardUrl.toString();
50+
window.location.replace(forwardUrl.toString());
5151
}, [isCallbackInProgress, potentialAuthFlow, code, state, iss]);
5252

5353
return {

src/lib/api/fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const fetchApiServer = async (
4949
if (!res.ok) {
5050
if (res.status === 401) {
5151
// Unauthorized, redirect to the login page
52-
window.location.href = `/api/auth/onboarding/login`;
52+
window.location.replace('/api/auth/onboarding/login');
5353
}
5454
const error = new APIError(
5555
'An error occurred while fetching the data.',

src/spaces/mcp/auth/AuthContextMcp.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export function AuthProviderMcp({ children }: { children: ReactNode }) {
6161
const login = () => {
6262
sessionStorage.setItem(AUTH_FLOW_SESSION_KEY, 'mcp');
6363

64-
window.location.href = `/api/auth/mcp/login?redirectTo=${encodeURIComponent(window.location.hash)}`;
64+
window.location.replace(
65+
`/api/auth/mcp/login?redirectTo=${encodeURIComponent(window.location.hash)}`,
66+
);
6567
};
6668

6769
return (

src/spaces/onboarding/auth/AuthContextOnboarding.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export function AuthProviderOnboarding({ children }: { children: ReactNode }) {
6969
const login = () => {
7070
sessionStorage.setItem(AUTH_FLOW_SESSION_KEY, 'onboarding');
7171

72-
window.location.href = `/api/auth/onboarding/login?redirectTo=${encodeURIComponent(window.location.hash)}`;
72+
window.location.replace(
73+
`/api/auth/onboarding/login?redirectTo=${encodeURIComponent(window.location.hash)}`,
74+
);
7375
};
7476

7577
const logout = async () => {

0 commit comments

Comments
 (0)