Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

Pass UTM params through on redirect

Dave Earley6213e64eaebb
diff --git a/frontend/src/components/routes/auth/Login/index.tsx b/frontend/src/components/routes/auth/Login/index.tsx
index b2ca2cd0a..43a25f130 100644
--- a/frontend/src/components/routes/auth/Login/index.tsx
+++ b/frontend/src/components/routes/auth/Login/index.tsx
@@ -1,5 +1,5 @@
import {Button, PasswordInput, TextInput, Collapse, UnstyledButton} from "@mantine/core";
-import {NavLink} from "react-router";
+import {NavLink, useLocation} from "react-router";
import {useMutation} from "@tanstack/react-query";
import {notifications} from '@mantine/notifications';
import {authClient} from "../../../../api/auth.client.ts";
@@ -15,6 +15,7 @@ import {showError} from "../../../../utilites/notifications.tsx";
import {IconTicket, IconChevronDown} from "@tabler/icons-react";
const Login = () => {
+ const location = useLocation();
const form = useForm({
initialValues: {
email: '',
@@ -80,7 +81,7 @@ const Login = () => {
<p>
<Trans>
Don't have an account?{' '}
- <NavLink to={'/auth/register'}>
+ <NavLink to={`/auth/register${location.search}`}>
Sign up
</NavLink>
</Trans>
diff --git a/frontend/src/components/routes/auth/Register/index.tsx b/frontend/src/components/routes/auth/Register/index.tsx
index 1da5a9dba..f412de4c9 100644
--- a/frontend/src/components/routes/auth/Register/index.tsx
+++ b/frontend/src/components/routes/auth/Register/index.tsx
@@ -43,7 +43,7 @@ export const Register = () => {
const registerUser = (data: RegisterAccountRequest) => {
mutate.mutate({registerData: data}, {
onSuccess: () => {
- navigate('/welcome');
+ navigate(`/welcome${location.search}`);
},
onError: (error: any) => {
errorHandler(form, error, error.response?.data?.message);
@@ -67,7 +67,7 @@ export const Register = () => {
<p>
<Trans>
Already have an account?{' '}
- <NavLink to={'/auth/login'}>
+ <NavLink to={`/auth/login${location.search}`}>
{t`Log in`}
</NavLink>
</Trans>
diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx
index 797717186..9295d32e0 100644
--- a/frontend/src/router.tsx
+++ b/frontend/src/router.tsx
@@ -12,7 +12,9 @@ const Root = () => {
useEffect(() => {
if (me.isFetched) {
- setRedirectPath(me.isSuccess ? "/manage/events" : "/auth/login");
+ const searchParams = typeof window !== 'undefined' ? window.location.search : '';
+ const basePath = me.isSuccess ? "/manage/events" : "/auth/login";
+ setRedirectPath(basePath + searchParams);
}
}, [me.isFetched]);