Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: prevent redundant login redirect when already on auth pages

YuTengjing1a5049c5b03d
diff --git a/src/store/user/slices/auth/action.ts b/src/store/user/slices/auth/action.ts
index 51f78341613..ad76b5f2c7a 100644
--- a/src/store/user/slices/auth/action.ts
+++ b/src/store/user/slices/auth/action.ts
@@ -108,6 +108,16 @@ export const createAuthSlice: StateCreator<
}
},
openLogin: async () => {
+ // Skip if already on a login page
+ const pathname = location.pathname;
+ if (
+ pathname.startsWith('/signin') ||
+ pathname.startsWith('/signup') ||
+ pathname.startsWith('/login')
+ ) {
+ return;
+ }
+
if (enableClerk) {
const redirectUrl = location.toString();
get().clerkSignIn?.({