File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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 } ` ,
You can’t perform that action at this time.
0 commit comments