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'] =
|
||||
spreeCategoriesSuccessResponse.data.sort(taxonsSort).map((spreeTaxon) => {
|
||||
return {
|
||||
id: spreeTaxon.id,
|
||||
name: spreeTaxon.attributes.name,
|
||||
slug: spreeTaxon.id,
|
||||
path: spreeTaxon.id,
|
||||
}
|
||||
})
|
||||
spreeCategoriesSuccessResponse.data
|
||||
.sort(taxonsSort)
|
||||
.map((spreeTaxon: TaxonAttr) => {
|
||||
return {
|
||||
id: spreeTaxon.id,
|
||||
name: spreeTaxon.attributes.name,
|
||||
slug: spreeTaxon.id,
|
||||
path: spreeTaxon.id,
|
||||
}
|
||||
})
|
||||
|
||||
const normalizedBrands: GetSiteInfoOperation['data']['brands'] =
|
||||
spreeBrandsSuccessResponse.data.sort(taxonsSort).map((spreeTaxon) => {
|
||||
return {
|
||||
node: {
|
||||
entityId: spreeTaxon.id,
|
||||
path: `brands/${spreeTaxon.id}`,
|
||||
name: spreeTaxon.attributes.name,
|
||||
},
|
||||
}
|
||||
})
|
||||
spreeBrandsSuccessResponse.data
|
||||
.sort(taxonsSort)
|
||||
.map((spreeTaxon: TaxonAttr) => {
|
||||
return {
|
||||
node: {
|
||||
entityId: spreeTaxon.id,
|
||||
path: `brands/${spreeTaxon.id}`,
|
||||
name: spreeTaxon.attributes.name,
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
categories: normalizedCategories,
|
||||
|
Loading…
x
Reference in New Issue
Block a user