Merged in fix/clear-guest-form (pull request #3168)
fix(STAY-120): Avoid prefilling edit guest details form in MyStay * fix: Avoid prefilling edit guest details form in MyStay fix: Avoid prefilling edit guest details form in MyStay Approved-by: Erik Tiekstra Approved-by: Elin Svedin Approved-by: Linus Flood
This commit is contained in:
@@ -7,6 +7,7 @@ import { FormProvider, useForm } from "react-hook-form"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import { profileEdit } from "@scandic-hotels/common/constants/routes/myPages"
|
||||
import { formatPhoneNumber } from "@scandic-hotels/common/utils/phone"
|
||||
import { MaterialIcon } from "@scandic-hotels/design-system/Icons/MaterialIcon"
|
||||
import Modal from "@scandic-hotels/design-system/Modal"
|
||||
import { ModalContentWithActions } from "@scandic-hotels/design-system/Modal/ModalContentWithActions"
|
||||
@@ -62,10 +63,14 @@ export default function GuestDetails({
|
||||
defaultValues: {
|
||||
firstName: guest.firstName,
|
||||
lastName: guest.lastName,
|
||||
email: guest.email,
|
||||
phoneNumber: guest.phoneNumber,
|
||||
email: "",
|
||||
phoneNumber: "",
|
||||
// Default country code to guest country code since we don't have anything better to default to
|
||||
phoneNumberCC: guest.countryCode.toLowerCase(),
|
||||
countryCode: guest.countryCode,
|
||||
},
|
||||
mode: "all",
|
||||
reValidateMode: "onChange",
|
||||
})
|
||||
|
||||
const isFirstStep = currentStep === MODAL_STEPS.INITIAL
|
||||
@@ -116,7 +121,7 @@ export default function GuestDetails({
|
||||
refId,
|
||||
guest: {
|
||||
email: data.email,
|
||||
phoneNumber: data.phoneNumber,
|
||||
phoneNumber: formatPhoneNumber(data.phoneNumber, data.phoneNumberCC),
|
||||
countryCode: data.countryCode,
|
||||
},
|
||||
language: lang,
|
||||
|
||||
Reference in New Issue
Block a user