mirror of
https://github.com/vercel/commerce.git
synced 2025-07-04 12:11:22 +00:00
Add types to Spree taxons mapping
This commit is contained in:
parent
3d2ee58c4d
commit
eba8c28cc5
@ -111,25 +111,29 @@ export default function getSiteInfoOperation({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const normalizedCategories: GetSiteInfoOperation['data']['categories'] =
|
const normalizedCategories: GetSiteInfoOperation['data']['categories'] =
|
||||||
spreeCategoriesSuccessResponse.data.sort(taxonsSort).map((spreeTaxon) => {
|
spreeCategoriesSuccessResponse.data
|
||||||
return {
|
.sort(taxonsSort)
|
||||||
id: spreeTaxon.id,
|
.map((spreeTaxon: TaxonAttr) => {
|
||||||
name: spreeTaxon.attributes.name,
|
return {
|
||||||
slug: spreeTaxon.id,
|
id: spreeTaxon.id,
|
||||||
path: spreeTaxon.id,
|
name: spreeTaxon.attributes.name,
|
||||||
}
|
slug: spreeTaxon.id,
|
||||||
})
|
path: spreeTaxon.id,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const normalizedBrands: GetSiteInfoOperation['data']['brands'] =
|
const normalizedBrands: GetSiteInfoOperation['data']['brands'] =
|
||||||
spreeBrandsSuccessResponse.data.sort(taxonsSort).map((spreeTaxon) => {
|
spreeBrandsSuccessResponse.data
|
||||||
return {
|
.sort(taxonsSort)
|
||||||
node: {
|
.map((spreeTaxon: TaxonAttr) => {
|
||||||
entityId: spreeTaxon.id,
|
return {
|
||||||
path: `brands/${spreeTaxon.id}`,
|
node: {
|
||||||
name: spreeTaxon.attributes.name,
|
entityId: spreeTaxon.id,
|
||||||
},
|
path: `brands/${spreeTaxon.id}`,
|
||||||
}
|
name: spreeTaxon.attributes.name,
|
||||||
})
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categories: normalizedCategories,
|
categories: normalizedCategories,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user