Skip to content

Commit e5790aa

Browse files
chore: code refactor
1 parent a223933 commit e5790aa

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

apps/web/core/components/onboarding/profile-setup.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const ProfileSetup = observer(function ProfileSetup(props: Props) {
139139
avatar_url: formData.avatar_url ?? undefined,
140140
};
141141
const profileUpdatePayload: Partial<TUserProfile> = {
142-
use_case: formData.use_case,
142+
use_case: formData.use_case && formData.use_case.length > 0 ? formData.use_case.join(". ") : undefined,
143143
role: formData.role,
144144
};
145145
try {
@@ -151,7 +151,7 @@ export const ProfileSetup = observer(function ProfileSetup(props: Props) {
151151
captureSuccess({
152152
eventName: USER_TRACKER_EVENTS.add_details,
153153
payload: {
154-
use_case: formData.use_case,
154+
use_case: profileUpdatePayload.use_case,
155155
role: formData.role,
156156
},
157157
});
@@ -212,7 +212,7 @@ export const ProfileSetup = observer(function ProfileSetup(props: Props) {
212212

213213
const handleSubmitUserPersonalization = async (formData: TProfileSetupFormValues) => {
214214
const profileUpdatePayload: Partial<TUserProfile> = {
215-
use_case: formData.use_case,
215+
use_case: formData.use_case && formData.use_case.length > 0 ? formData.use_case.join(". ") : undefined,
216216
role: formData.role,
217217
};
218218
try {
@@ -223,7 +223,7 @@ export const ProfileSetup = observer(function ProfileSetup(props: Props) {
223223
captureSuccess({
224224
eventName: USER_TRACKER_EVENTS.add_details,
225225
payload: {
226-
use_case: formData.use_case,
226+
use_case: profileUpdatePayload.use_case,
227227
role: formData.role,
228228
},
229229
});

apps/web/core/components/onboarding/steps/usecase/root.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ export const UseCaseSetupStep = observer(function UseCaseSetupStep({ handleStepC
3636
} = useForm<TProfileSetupFormValues>({
3737
defaultValues: {
3838
...defaultValues,
39-
use_case: profile?.use_case,
39+
use_case: profile?.use_case ? profile.use_case.split(". ") : [],
4040
},
4141
mode: "onChange",
4242
});
4343

4444
// handle submit
4545
const handleSubmitUserPersonalization = async (formData: TProfileSetupFormValues) => {
4646
const profileUpdatePayload: Partial<TUserProfile> = {
47-
use_case: formData.use_case,
47+
use_case: formData.use_case && formData.use_case.length > 0 ? formData.use_case.join(". ") : undefined,
4848
};
4949
try {
5050
await Promise.all([
@@ -54,7 +54,7 @@ export const UseCaseSetupStep = observer(function UseCaseSetupStep({ handleStepC
5454
captureSuccess({
5555
eventName: USER_TRACKER_EVENTS.add_details,
5656
payload: {
57-
use_case: formData.use_case,
57+
use_case: profileUpdatePayload.use_case,
5858
},
5959
});
6060
setToast({

packages/types/src/current-user/profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type TUserProfile = {
1818
is_onboarded: boolean;
1919
is_tour_completed: boolean;
2020

21-
use_case: string[] | undefined;
21+
use_case: string | undefined;
2222

2323
billing_address_country: string | undefined;
2424
billing_address: string | undefined;

packages/types/src/users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export type TUserProfile = {
7272
onboarding_step: TOnboardingSteps;
7373
is_onboarded: boolean;
7474
is_tour_completed: boolean;
75-
use_case: string[] | undefined;
75+
use_case: string | undefined;
7676
billing_address_country: string | undefined;
7777
billing_address: string | undefined;
7878
has_billing_address: boolean;

0 commit comments

Comments
 (0)