static path
							parent
							
								
									c3e386a8a1
								
							
						
					
					
						commit
						04fdf51e7b
					
				|  | @ -79,6 +79,38 @@ const gql = ` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| `; | `; | ||||||
|  | const gql_static = ` | ||||||
|  | query Products($locale:I18NLocaleCode,$start:Int,$limit:Int) { | ||||||
|  |     products(locale: $locale, pagination: { start: $start, limit: $limit }) { | ||||||
|  |         slug | ||||||
|  |         category { | ||||||
|  |             slug | ||||||
|  |         } | ||||||
|  |         brand { | ||||||
|  |             slug | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | ` | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | export async function generateStaticParams() { | ||||||
|  |     const { products } = await graphql(gql_static, { | ||||||
|  |         "locale": "en", | ||||||
|  |         "start": 0, | ||||||
|  |         "limit": 1500 | ||||||
|  |     }) | ||||||
|  |     const params = []; | ||||||
|  |     products.forEach((product) => { | ||||||
|  |         params.push({ category: product.category.slug, slug: product.slug }) | ||||||
|  |         params.push({ category: product.brand.slug, slug: product.slug }) | ||||||
|  |     }) | ||||||
|  |     return params; | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| const getProduct = async (slug) => { | const getProduct = async (slug) => { | ||||||
|     const { products } = await graphql(gql, { |     const { products } = await graphql(gql, { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue