Fix sale create view

This commit is contained in:
dominik-zeglen 2019-10-24 15:25:26 +02:00
parent 5131c50d45
commit 3c103160f4

View file

@ -6,7 +6,7 @@ import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier";
import useShop from "@saleor/hooks/useShop";
import { sectionNames } from "@saleor/intl";
import { decimal, getMutationState, maybe } from "../../misc";
import { decimal, getMutationState, joinDateTime, maybe } from "../../misc";
import { DiscountValueTypeEnum, SaleType } from "../../types/globalTypes";
import SaleCreatePage from "../components/SaleCreatePage";
import { TypedSaleCreate } from "../mutations";
@ -57,11 +57,14 @@ export const SaleDetails: React.StatelessComponent = () => {
saleCreate({
variables: {
input: {
endDate:
formData.endDate === "" ? null : formData.endDate,
endDate: formData.hasEndDate
? joinDateTime(formData.endDate, formData.endTime)
: null,
name: formData.name,
startDate:
formData.startDate === "" ? null : formData.startDate,
startDate: joinDateTime(
formData.startDate,
formData.startTime
),
type: discountValueTypeEnum(formData.type),
value: decimal(formData.value)
}