fix: now parses phone number before submitting on edit profile and signup
This commit is contained in:
@@ -9,6 +9,7 @@ import { useIntl } from "react-intl"
|
||||
import { Button } from "@scandic-hotels/design-system/Button"
|
||||
import { Typography } from "@scandic-hotels/design-system/Typography"
|
||||
|
||||
import { getDefaultCountryFromLang } from "@/constants/languages"
|
||||
import {
|
||||
membershipTermsAndConditions,
|
||||
privacyPolicy,
|
||||
@@ -25,6 +26,7 @@ import Link from "@/components/TempDesignSystem/Link"
|
||||
import { toast } from "@/components/TempDesignSystem/Toasts"
|
||||
import { useFormTracking } from "@/components/TrackingSDK/hooks"
|
||||
import useLang from "@/hooks/useLang"
|
||||
import { formatPhoneNumber } from "@/utils/phone"
|
||||
|
||||
import { type SignUpSchema, signUpSchema } from "./schema"
|
||||
|
||||
@@ -73,7 +75,7 @@ export default function SignupForm({ title }: SignUpFormProps) {
|
||||
lastName: "",
|
||||
email: "",
|
||||
phoneNumber: "",
|
||||
phoneNumberCC: "",
|
||||
phoneNumberCC: getDefaultCountryFromLang(lang),
|
||||
dateOfBirth: "",
|
||||
address: {
|
||||
countryCode: "",
|
||||
@@ -94,7 +96,8 @@ export default function SignupForm({ title }: SignUpFormProps) {
|
||||
useFormTracking("signup", subscribe, control)
|
||||
|
||||
async function onSubmit(data: SignUpSchema) {
|
||||
signup.mutate({ ...data, language: lang })
|
||||
const phoneNumber = formatPhoneNumber(data.phoneNumber, data.phoneNumberCC)
|
||||
signup.mutate({ ...data, phoneNumber, language: lang })
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user