Resolved convert window visibility and job import error when vehicle already exists IO-426

This commit is contained in:
Patrick Fic
2020-12-02 15:09:41 -08:00
parent d9b5a5a88d
commit 6e1a36000e
2 changed files with 20 additions and 16 deletions

View File

@@ -6,7 +6,10 @@ import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { CONVERT_JOB_TO_RO } from "../../graphql/jobs.queries";
import { selectJobReadOnly } from "../../redux/application/application.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import {
selectAuthLevel,
selectBodyshop,
} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -22,16 +25,18 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO }) {
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
const { t } = useTranslation();
const handleConvert = (values) => {
mutationConvertJob({
const handleConvert = async (values) => {
const res = await mutationConvertJob({
variables: { jobId: job.id, ...values },
}).then((r) => {
refetch();
});
if (!res.errors) {
refetch();
notification["success"]({
message: t("jobs.successes.converted"),
});
});
setVisible(false);
}
};
const popMenu = (