save before rebase

This commit is contained in:
Reza Babaei
2021-09-18 00:48:20 +03:00
parent 9c8a78360d
commit 91ea63bff8
6 changed files with 94 additions and 42 deletions

View File

@@ -1,3 +1,4 @@
import { useEffect } from 'react'
import commerce from '@lib/api/commerce'
import { Layout } from '@components/common'
import { ProductCard } from '@components/product'
@@ -11,26 +12,35 @@ export async function getStaticProps({
locales,
}: GetStaticPropsContext) {
const config = { locale, locales }
const productsPromise = commerce.getAllProducts({
const productsPromise = await commerce.getAllProducts({
variables: { first: 6 },
config,
preview,
// Saleor provider only
...({ featured: true } as any),
// // Saleor provider only
// ...({ featured: true } as any),
})
// // const pagesPromise = commerce.getAllPages({ config, preview })
// // const siteInfoPromise = commerce.getSiteInfo({ config, preview })
// // const { products } = await productsPromise
// // const { pages } = await pagesPromise
// // const { categories, brands } = await siteInfoPromise
console.log({
query: {
variables: { first: 6 },
config,
preview,
// // Saleor provider only
// ...({ featured: true } as any),
},
productsPromise,
})
// const pagesPromise = commerce.getAllPages({ config, preview })
// const siteInfoPromise = commerce.getSiteInfo({ config, preview })
// const { products } = await productsPromise
// const { pages } = await pagesPromise
// const { categories, brands } = await siteInfoPromise
return {
// props: {
// products,
// categories,
// brands,
// pages,
// },
props: {
products: [],
// categories,
// brands,
// pages,
},
revalidate: 60,
}
}

View File

@@ -23,7 +23,7 @@ export async function getStaticProps({
preview,
})
const allProductsPromise = commerce.getAllProducts({
const allProductsPromise = await commerce.getAllProducts({
variables: { first: 4 },
config,
preview,