mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Added basis setup and type generation for the products queries
This commit is contained in:
@@ -14,27 +14,30 @@ export type BrandEdge = {
|
||||
|
||||
export type Brands = BrandEdge[]
|
||||
|
||||
// TODO: Find a way to get vendors from meta
|
||||
const getVendors = async (config: SaleorConfig): Promise<BrandEdge[]> => {
|
||||
const vendors = await fetchAllProducts({
|
||||
config,
|
||||
query: getAllProductVendors,
|
||||
variables: {
|
||||
first: 250,
|
||||
},
|
||||
})
|
||||
// const vendors = await fetchAllProducts({
|
||||
// config,
|
||||
// query: getAllProductVendors,
|
||||
// variables: {
|
||||
// first: 100,
|
||||
// },
|
||||
// })
|
||||
|
||||
let vendorsStrings = vendors.map(({ node: { vendor } }) => vendor)
|
||||
// let vendorsStrings = vendors.map(({ node: { vendor } }) => vendor)
|
||||
|
||||
return [...new Set(vendorsStrings)].map((v) => {
|
||||
const id = v.replace(/\s+/g, '-').toLowerCase()
|
||||
return {
|
||||
node: {
|
||||
entityId: id,
|
||||
name: v,
|
||||
path: `brands/${id}`,
|
||||
},
|
||||
}
|
||||
})
|
||||
// return [...new Set(vendorsStrings)].map((v) => {
|
||||
// const id = v.replace(/\s+/g, '-').toLowerCase()
|
||||
// return {
|
||||
// node: {
|
||||
// entityId: id,
|
||||
// name: v,
|
||||
// path: `brands/${id}`,
|
||||
// },
|
||||
// }
|
||||
// })
|
||||
|
||||
return []
|
||||
}
|
||||
|
||||
export default getVendors
|
||||
|
Reference in New Issue
Block a user