Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

preserve query params for login redirect (#2014)

Will Hutchinsonceb8e550f340
diff --git a/js/app/packages/app/component/Root.tsx b/js/app/packages/app/component/Root.tsx
index 79b7a8b0e4..9b890535a4 100644
--- a/js/app/packages/app/component/Root.tsx
+++ b/js/app/packages/app/component/Root.tsx
@@ -178,7 +178,9 @@ function BasePathComponent() {
<Match
when={!userInfoQuery.isLoading && !userInfoQuery.data?.authenticated}
>
- <Navigate href={isNativeMobilePlatform() ? '/login' : '/signup'} />
+ <Navigate
+ href={`${isNativeMobilePlatform() ? '/login' : '/signup'}${window.location.search}`}
+ />
</Match>
<Match when={userInfoQuery.data?.authenticated}>
<Navigate href={redirectPath} />
diff --git a/js/app/packages/core/component/TopBar/LoginButton.tsx b/js/app/packages/core/component/TopBar/LoginButton.tsx
index 2801d1cad7..605e10a381 100644
--- a/js/app/packages/core/component/TopBar/LoginButton.tsx
+++ b/js/app/packages/core/component/TopBar/LoginButton.tsx
@@ -6,18 +6,24 @@ export function openLoginModal() {
const isAuthenticated = useIsAuthenticated();
if (isAuthenticated()) return;
- window.location.href = `${window.location.origin}/app/login`;
+ const params = new URLSearchParams(window.location.search);
+ const queryString = params.size > 0 ? `?${params.toString()}` : '';
+ window.location.href = `${window.location.origin}/app/login${queryString}`;
}
export function LoginButton() {
const navigate = useNavigate();
return (
<div class="flex gap-2 justify-center w-max items-baseline font-mono">
- <DeprecatedButton onClick={() => navigate('/login')}>
+ <DeprecatedButton
+ onClick={() => navigate(`/login${window.location.search}`)}
+ >
Login
</DeprecatedButton>
<span class="italic">or</span>
- <DeprecatedButton onClick={() => navigate('/signup')}>
+ <DeprecatedButton
+ onClick={() => navigate(`/signup${window.location.search}`)}
+ >
Sign Up
</DeprecatedButton>
</div>