Skip to content

Commit ec0baf4

Browse files
authored
Merge pull request #1411 from AppQuality/join-page-template-id
fix: include templateId in the basicInfo object during form submission
2 parents e1a9f1f + 6c73566 commit ec0baf4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/pages/JoinPage/useJoinSubmit.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ export function useJoinSubmit(isInvited: boolean) {
1515
const { token, profile } = useParams();
1616
const sendGTMevent = useSendGTMevent({ loggedUser: false });
1717

18+
const templateParam = searchParams.get('template');
19+
let templateId: number | undefined;
20+
21+
if (templateParam !== null) {
22+
const parsed = Number(templateParam);
23+
if (!Number.isInteger(parsed)) {
24+
searchParams.delete('template');
25+
const url = window.location.origin + window.location.pathname;
26+
window.history.replaceState({}, '', url);
27+
window.location.reload();
28+
}
29+
templateId = parsed;
30+
}
31+
1832
const onSubmit = useCallback(
1933
async (
2034
values: JoinFormValues,
@@ -28,7 +42,9 @@ export function useJoinSubmit(isInvited: boolean) {
2842
surname: values.surname,
2943
roleId: values.roleId,
3044
companySizeId: values.companySizeId,
45+
...(templateId !== undefined && { templateId }),
3146
};
47+
3248
sendGTMevent({
3349
event: 'sign-up-flow',
3450
category: `is invited: ${isInvited}`,

0 commit comments

Comments
 (0)