Add policy for use name instead of slug (#2402)
This commit is contained in:
parent
d67e4799b2
commit
faa41039fe
1 changed files with 19 additions and 0 deletions
|
@ -46,6 +46,25 @@ export const apolloClient = new ApolloClient({
|
||||||
Shop: {
|
Shop: {
|
||||||
keyFields: [],
|
keyFields: [],
|
||||||
},
|
},
|
||||||
|
AttributeValue: {
|
||||||
|
fields: {
|
||||||
|
/**
|
||||||
|
* Since, API sometimes creates an empty slug,
|
||||||
|
* We need to handle that case also on front-end,
|
||||||
|
* so after fix that problem in the API, the UI will ablle
|
||||||
|
* to handle it.
|
||||||
|
*
|
||||||
|
* If the slug is empty, use the name
|
||||||
|
*/
|
||||||
|
slug: (givenSlug, { readField }) => {
|
||||||
|
if (!givenSlug) {
|
||||||
|
return readField("name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return givenSlug;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
} as TypedTypePolicies,
|
} as TypedTypePolicies,
|
||||||
}),
|
}),
|
||||||
link,
|
link,
|
||||||
|
|
Loading…
Reference in a new issue