ProPhoneInput: fix validation and value

This commit is contained in:
2025-11-13 14:33:41 +03:00
parent 0764d3a641
commit a29aa896e0
4 changed files with 65 additions and 48 deletions

View File

@@ -1,23 +1,19 @@
import ProInputCard from "components/ProInputCard/ProInputCard.tsx";
import ProPhoneInput from "components/ProPhoneInput";
import { selectCart, updatePhone } from "features/order/orderSlice";
import { selectCart } from "features/order/orderSlice";
import { useTranslation } from "react-i18next";
import { useAppDispatch, useAppSelector } from "redux/hooks";
import { useAppSelector } from "redux/hooks";
import { OrderType } from "pages/checkout/hooks/types.ts";
export default function PhoneCard() {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const { phone, orderType } = useAppSelector(selectCart);
const { orderType } = useAppSelector(selectCart);
return (
orderType !== OrderType.Gift && (
<>
<ProInputCard title={t("checkout.phoneNumber")}>
<ProPhoneInput
phone={phone}
setPhone={(phone) => dispatch(updatePhone(phone))}
/>
<ProPhoneInput />
</ProInputCard>
</>
)