CC Conversion Corrections IO-463
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import { Form, notification } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { useHistory } from "react-router-dom";
|
||||
@@ -27,11 +27,13 @@ export function CourtesyCarCreateContainer({
|
||||
setSelectedHeader,
|
||||
}) {
|
||||
const [form] = Form.useForm();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [insertCourtesyCar] = useMutation(INSERT_NEW_COURTESY_CAR);
|
||||
const { t } = useTranslation();
|
||||
const history = useHistory();
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
setLoading(true);
|
||||
const result = await insertCourtesyCar({
|
||||
variables: { courtesycar: { ...values, bodyshopid: bodyshop.id } },
|
||||
});
|
||||
@@ -42,7 +44,9 @@ export function CourtesyCarCreateContainer({
|
||||
message: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
setLoading(false);
|
||||
} else {
|
||||
setLoading(false);
|
||||
form.resetFields();
|
||||
form.resetFields();
|
||||
notification["success"]({ message: t("courtesycars.successes.saved") });
|
||||
@@ -67,7 +71,7 @@ export function CourtesyCarCreateContainer({
|
||||
return (
|
||||
<RbacWrapper action="courtesycar:create">
|
||||
<Form form={form} autoComplete="new-password" onFinish={handleFinish}>
|
||||
<CourtesyCarFormComponent form={form} />
|
||||
<CourtesyCarFormComponent form={form} saveLoading={loading} />
|
||||
</Form>
|
||||
</RbacWrapper>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user