diff --git a/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx b/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx index e231ffd..18cd6e8 100644 --- a/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx +++ b/lib/components/ViewPublicationPage/ContactForm/CustomInput/CustomInput.tsx @@ -24,13 +24,13 @@ type InputProps = { const TextField = MuiTextField as unknown as FC; let first = true; -function phoneChange(e: ChangeEvent, mask: string) { +function phoneChange(newValue: string, mask: string) { const masked = IMask.createMask({ mask: "+7 (000) 000-00-00", // ...and other options }); - masked.value = e.target.value; - const a = IMask.pipe(e.target.value, { + masked.value = newValue; + const a = IMask.pipe(newValue, { mask, }); return a || ""; @@ -68,7 +68,7 @@ export const CustomInput = ({ // inputRef={isPhone ? ref : null} //@ts-ignore onChange={(e: ChangeEvent) => - isPhone ? onChangePhone?.(phoneChange(e, mask)) : onChange?.(e) + isPhone ? onChangePhone?.(phoneChange(e.target.value, mask)) : onChange?.(e) } onBlur={onBlur} type={isPhone ? "tel" : type} @@ -106,7 +106,16 @@ export const CustomInput = ({ ), endAdornment: ( - {isPhone && } + + {isPhone && ( + { + onChangePhone?.(phoneChange("", mask)); + setMask(e); + }} + /> + )} + ), }} /> diff --git a/lib/utils/defineDomain.ts b/lib/utils/defineDomain.ts index 6424872..94278b9 100644 --- a/lib/utils/defineDomain.ts +++ b/lib/utils/defineDomain.ts @@ -12,7 +12,7 @@ const isProduction = !( ); //туризм больше не в исключениях -if (!isProduction) domain = "https://hbpn.link"; +if (!isProduction) domain = "https://s.hbpn.link"; // domain = "https://hbpn.link"; export { domain, isProduction };