values set only a for few inputType (#2355)

This commit is contained in:
Anna Szczęch 2022-10-07 11:07:34 +02:00 committed by GitHub
parent f349bbc86a
commit e7a7b79f3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,9 +3,16 @@ export function createAttribute({
attributeValues = ["value"], attributeValues = ["value"],
type = "PRODUCT_TYPE", type = "PRODUCT_TYPE",
inputType = "DROPDOWN", inputType = "DROPDOWN",
filterableInDashboard = false filterableInDashboard = false,
values = [],
}) { }) {
const values = attributeValues.map(element => `{name:"${element}"}`); if (
inputType === "MULTISELECT" ||
inputType === "DROPDOWN" ||
inputType === "SWATCH"
) {
values = attributeValues.map(element => `{name:"${element}"}`);
}
const mutation = `mutation{ const mutation = `mutation{
attributeCreate(input:{ attributeCreate(input:{
name:"${name}" name:"${name}"