Djordje Mitrovic 3 vuotta sitten
vanhempi
commit
b39b9528a8

+ 15
- 4
src/components/ProfileCard/EditProfile/EditProfile.js Näytä tiedosto

@@ -53,6 +53,7 @@ const EditProfile = (props) => {
};

const handleSubmit = (values) => {
console.log(values);
dispatch(editMineProfile({ ...values, handleApiResponseSuccess }));
props.closeModalHandler();
};
@@ -172,14 +173,24 @@ const EditProfile = (props) => {
type="number"
name="firmPhone"
value={formik.values.firmPhone}
onChange={formik.handleChange}
onChange={(event) => {
formik.setFieldValue("firmPhone", event.target.value);
}}
error={formik.touched.firmPhone && formik.errors.firmPhone}
margin="normal"
fullWidth
onInput={(e) => {
e.target.value = Math.max(0, parseInt(e.target.value))
.toString()
.slice(0, 14);
e.target.value =
e.target.value[0] === "0" && e.target.value.length > 1
? "0" +
String(
Math.max(0, parseInt(e.target.value))
.toString()
.slice(0, 14)
)
: Math.max(0, parseInt(e.target.value))
.toString()
.slice(0, 14);
}}
/>
</DetailsInfo>

+ 1
- 1
src/validations/editProfileValidation.js Näytä tiedosto

@@ -11,7 +11,7 @@ export default Yup.object().shape({
),
firmWebsite: Yup.string(),
firmApplink: Yup.string(),
firmPhone: Yup.number()
firmPhone: Yup.string()
.required(i18n.t("editProfile.labelPhoneRequired"))
.min(6, i18n.t("editProfile.labelPhoneValid"))
.max(14, i18n.t("editProfile.labelPhoneValid")),

Loading…
Peruuta
Tallenna