refactor phase 3a myportal contactus targeted actions imports
This commit is contained in:
@@ -13,10 +13,11 @@ import {
|
|||||||
formValueSelector,
|
formValueSelector,
|
||||||
reduxForm,
|
reduxForm,
|
||||||
touch,
|
touch,
|
||||||
SubmissionError,
|
SubmissionError
|
||||||
} from "redux-form";
|
} from "redux-form";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createCRMTask, sendEmail } from "../../actions";
|
import { createCRMTask } from "../../actions/services/integrationService";
|
||||||
|
import { sendEmail } from "../../actions/services/notifyService";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ const RenderPickList = ({
|
|||||||
label,
|
label,
|
||||||
input,
|
input,
|
||||||
errorMsg,
|
errorMsg,
|
||||||
meta: { touched, error },
|
meta: { touched, error }
|
||||||
}) => {
|
}) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
@@ -318,7 +319,7 @@ let ContactUs = (props) => {
|
|||||||
const sendContactEmail = async (formValues) => {
|
const sendContactEmail = async (formValues) => {
|
||||||
Object.assign(formValues, {
|
Object.assign(formValues, {
|
||||||
"contactSubject": contactPurpose(formValues.typeOfContact).props
|
"contactSubject": contactPurpose(formValues.typeOfContact).props
|
||||||
.children,
|
.children
|
||||||
});
|
});
|
||||||
|
|
||||||
const reference = "PEDW-CONTACT-US";
|
const reference = "PEDW-CONTACT-US";
|
||||||
@@ -340,7 +341,7 @@ let ContactUs = (props) => {
|
|||||||
alert("Something went wrong. Please try again later.");
|
alert("Something went wrong. Please try again later.");
|
||||||
// Required: inform redux-form this is a submit error
|
// Required: inform redux-form this is a submit error
|
||||||
throw new SubmissionError({
|
throw new SubmissionError({
|
||||||
_error: "Failed to send email. Please try again later.",
|
_error: "Failed to send email. Please try again later."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -367,7 +368,7 @@ let ContactUs = (props) => {
|
|||||||
alert("Something went wrong. Please try again later.");
|
alert("Something went wrong. Please try again later.");
|
||||||
// Required: inform redux-form this is a submit error
|
// Required: inform redux-form this is a submit error
|
||||||
throw new SubmissionError({
|
throw new SubmissionError({
|
||||||
_error: "Failed to send email. Please try again later.",
|
_error: "Failed to send email. Please try again later."
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -514,7 +515,7 @@ const mapStateToProps = (state) => {
|
|||||||
accountDetails: state.accountDetails,
|
accountDetails: state.accountDetails,
|
||||||
typeOfContactValue,
|
typeOfContactValue,
|
||||||
initialValues: email ? { contactEmail: email } : {},
|
initialValues: email ? { contactEmail: email } : {},
|
||||||
petEmail: process.env.NEXT_PUBLIC_PETEMAIL,
|
petEmail: process.env.NEXT_PUBLIC_PETEMAIL
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -545,7 +546,7 @@ export default connect(
|
|||||||
) {
|
) {
|
||||||
errorElement.scrollIntoView({
|
errorElement.scrollIntoView({
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: "center",
|
block: "center"
|
||||||
});
|
});
|
||||||
errorElement.focus({ preventScroll: true });
|
errorElement.focus({ preventScroll: true });
|
||||||
} else {
|
} else {
|
||||||
@@ -557,6 +558,6 @@ export default connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("Redux Form onSubmitFail:", submitError);
|
console.log("Redux Form onSubmitFail:", submitError);
|
||||||
},
|
}
|
||||||
})(ContactUs)
|
})(ContactUs)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user