Skip to content

Commit 121c18d

Browse files
committed
feat: Reo things
1 parent 66d7d62 commit 121c18d

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/features/auth/SignIn.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ export function SignIn() {
5454
const defaultCloudRoute = getDefaultSignedInCloudRouteForUser(data);
5555

5656
const company = parseCompanyFromEmail(data.email);
57-
if (company) {
58-
reoClient?.identify?.({
59-
username: data.email,
60-
type: 'email',
61-
company,
62-
});
63-
}
57+
reoClient?.identify?.({
58+
username: data.email,
59+
type: 'email',
60+
...(company ? { company } : {}),
61+
});
6462
await queryClient.invalidateQueries({ queryKey: [queryKeys.user], refetchType: 'none' });
6563
void router.invalidate();
6664
await navigate({ to: redirect?.startsWith('/') ? redirect : defaultCloudRoute });

src/features/auth/SignUp.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { FormLabel } from '@/components/ui/form/FormLabel';
77
import { FormMessage } from '@/components/ui/form/FormMessage';
88
import { Input } from '@/components/ui/input';
99
import { useSignUpMutation } from '@/features/auth/hooks/useSignUp';
10+
import { reoClient } from '@/integrations/reo/reo';
11+
import { parseCompanyFromEmail } from '@/lib/string/parseCompanyFromEmail';
1012
import { zodRequireEmail } from '@/lib/zod/email';
1113
import { zodRequirePassword } from '@/lib/zod/password';
1214
import { zodResolver } from '@hookform/resolvers/zod';
@@ -73,6 +75,14 @@ export function SignUp() {
7375
onClick: () => toast.dismiss(),
7476
},
7577
});
78+
const company = parseCompanyFromEmail(userData.email);
79+
reoClient?.identify?.({
80+
username: userData.email,
81+
type: 'email',
82+
firstname: userData.firstname,
83+
lastname: userData.lastname,
84+
...(company ? { company } : {}),
85+
});
7686
navigate({ to: '/sign-in' });
7787
},
7888
});

src/integrations/reo/reodotdev.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ declare module 'reodotdev' {
33

44
export interface ReoClient {
55
init: null | (({ clientID: string }) => ReoClient);
6-
identify: null | ((person: { username: string; type: string; company: string; }) => void);
6+
identify: null | ((person: Record<string, unknown>) => void);
77
}
88
}

0 commit comments

Comments
 (0)