BOD-6 #comment Work In Progress for all JSON subfields for My Shop Management. Outstanding items to resolve.
This commit is contained in:
@@ -1,21 +1,24 @@
|
||||
import React, { useEffect } from "react";
|
||||
import ShopInfoComponent from "./shop-info.component";
|
||||
import { Form } from "antd";
|
||||
import { useQuery } from "react-apollo";
|
||||
import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
|
||||
import { useQuery, useMutation } from "react-apollo";
|
||||
import { QUERY_BODYSHOP, UPDATE_SHOP } from "../../graphql/bodyshop.queries";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
|
||||
export default function ShopInfoContainer() {
|
||||
const [form] = Form.useForm();
|
||||
const handleFinish = values => {
|
||||
console.log("values", values);
|
||||
};
|
||||
|
||||
const [updateBodyshop] = useMutation(UPDATE_SHOP);
|
||||
const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
|
||||
const handleFinish = values => {
|
||||
console.log("values", values);
|
||||
|
||||
updateBodyshop({ variables: { id: data.bodyshops[0].id, shop: values } });
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (data) form.resetFields();
|
||||
}, [form, data]);
|
||||
@@ -28,7 +31,7 @@ export default function ShopInfoContainer() {
|
||||
onFinish={handleFinish}
|
||||
initialValues={data ? data.bodyshops[0] : null}
|
||||
>
|
||||
<ShopInfoComponent />
|
||||
<ShopInfoComponent form={form} />
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user