Fix types
This commit is contained in:
parent
e9dabd4f1c
commit
89b2958a2f
2 changed files with 5 additions and 4 deletions
|
@ -98,7 +98,9 @@ const CustomerCreatePage: React.FC<CustomerCreatePageProps> = ({
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSubmit = (formData: CustomerCreatePageFormData) => {
|
const handleSubmit = (
|
||||||
|
formData: CustomerCreatePageFormData & AddressTypeInput
|
||||||
|
) => {
|
||||||
const areAddressInputFieldsModified = ([
|
const areAddressInputFieldsModified = ([
|
||||||
"city",
|
"city",
|
||||||
"companyName",
|
"companyName",
|
||||||
|
@ -115,7 +117,7 @@ const CustomerCreatePage: React.FC<CustomerCreatePageProps> = ({
|
||||||
.some(field => field !== "");
|
.some(field => field !== "");
|
||||||
|
|
||||||
if (areAddressInputFieldsModified) {
|
if (areAddressInputFieldsModified) {
|
||||||
handleSubmitWithAddress(formData as any);
|
handleSubmitWithAddress(formData);
|
||||||
} else {
|
} else {
|
||||||
onSubmit({
|
onSubmit({
|
||||||
address: null,
|
address: null,
|
||||||
|
|
|
@ -4,11 +4,10 @@ import { useIntl } from "react-intl";
|
||||||
import { WindowTitle } from "@saleor/components/WindowTitle";
|
import { WindowTitle } from "@saleor/components/WindowTitle";
|
||||||
import useNavigator from "@saleor/hooks/useNavigator";
|
import useNavigator from "@saleor/hooks/useNavigator";
|
||||||
import useNotifier from "@saleor/hooks/useNotifier";
|
import useNotifier from "@saleor/hooks/useNotifier";
|
||||||
import { maybe, transformFormToAddress } from "../../misc";
|
import { maybe } from "../../misc";
|
||||||
import CustomerCreatePage from "../components/CustomerCreatePage";
|
import CustomerCreatePage from "../components/CustomerCreatePage";
|
||||||
import { TypedCreateCustomerMutation } from "../mutations";
|
import { TypedCreateCustomerMutation } from "../mutations";
|
||||||
import { TypedCustomerCreateDataQuery } from "../queries";
|
import { TypedCustomerCreateDataQuery } from "../queries";
|
||||||
import { AddressTypeInput } from "../types";
|
|
||||||
import { CreateCustomer } from "../types/CreateCustomer";
|
import { CreateCustomer } from "../types/CreateCustomer";
|
||||||
import { customerListUrl, customerUrl } from "../urls";
|
import { customerListUrl, customerUrl } from "../urls";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue