update product create mutation create handler

This commit is contained in:
Magdalena Markusik 2020-09-21 12:24:11 +02:00
parent 52cf01ed72
commit 6ae8fcebcd
4 changed files with 7 additions and 0 deletions

View file

@ -145,6 +145,7 @@ export const productUpdateMutation = gql`
$name: String
$basePrice: PositiveDecimal
$seo: SeoInput
$slug: String
$visibleInListings: Boolean
) {
productUpdate(
@ -160,6 +161,7 @@ export const productUpdateMutation = gql`
name: $name
basePrice: $basePrice
seo: $seo
slug: $slug
visibleInListings: $visibleInListings
}
) {
@ -291,6 +293,7 @@ export const productCreateMutation = gql`
$productType: ID!
$sku: String
$seo: SeoInput
$slug: String
$stocks: [StockInput!]!
$trackInventory: Boolean!
$weight: WeightScalar
@ -310,6 +313,7 @@ export const productCreateMutation = gql`
productType: $productType
sku: $sku
seo: $seo
slug: $slug
stocks: $stocks
trackInventory: $trackInventory
weight: $weight

View file

@ -244,6 +244,7 @@ export interface ProductCreateVariables {
productType: string;
sku?: string | null;
seo?: SeoInput | null;
slug?: string | null;
stocks: StockInput[];
trackInventory: boolean;
weight?: any | null;

View file

@ -243,5 +243,6 @@ export interface ProductUpdateVariables {
name?: string | null;
basePrice?: any | null;
seo?: SeoInput | null;
slug?: string | null;
visibleInListings?: boolean | null;
}

View file

@ -95,6 +95,7 @@ export const ProductCreateView: React.FC = () => {
title: formData.seoTitle
},
sku: formData.sku,
slug: formData.slug,
stocks: formData.stocks.map(stock => ({
quantity: parseInt(stock.value, 0),
warehouse: stock.id