Skip to content

Commit 9fdac59

Browse files
authored
fix(console): should not parse phone number if it is empty (#5216)
1 parent d469e94 commit 9fdac59

File tree

1 file changed

+2
-2
lines changed
  • packages/console/src/pages/UserDetails/UserSettings

1 file changed

+2
-2
lines changed

packages/console/src/pages/UserDetails/UserSettings/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { emailRegEx, usernameRegEx } from '@logto/core-kit';
22
import type { User } from '@logto/schemas';
33
import { parsePhoneNumber } from '@logto/shared/universal';
4-
import { trySafe } from '@silverhand/essentials';
4+
import { conditionalString, trySafe } from '@silverhand/essentials';
55
import { parsePhoneNumberWithError } from 'libphonenumber-js';
66
import { useForm, useController } from 'react-hook-form';
77
import { toast } from 'react-hot-toast';
@@ -79,7 +79,7 @@ function UserSettings() {
7979

8080
const payload: Partial<User> = {
8181
...formData,
82-
primaryPhone: parsePhoneNumber(primaryPhone),
82+
primaryPhone: conditionalString(primaryPhone && parsePhoneNumber(primaryPhone)),
8383
customData: parseResult.data,
8484
};
8585

0 commit comments

Comments
 (0)