Removed old getConfig and references

This commit is contained in:
Luis Alvarez
2021-05-24 19:01:27 -05:00
parent a106629964
commit ee3e4143b9
19 changed files with 51 additions and 247 deletions

View File

@@ -8,7 +8,6 @@ import { Text } from '@components/ui'
import { Layout } from '@components/common'
import getSlug from '@lib/get-slug'
import { missingLocaleInPages } from '@lib/usage-warns'
import { getConfig } from '@framework/api'
import { defaultPageProps } from '@lib/defaults'
export async function getStaticProps({
@@ -16,7 +15,7 @@ export async function getStaticProps({
params,
locale,
}: GetStaticPropsContext<{ pages: string[] }>) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ preview, config })
const path = params?.pages.join('/')
const slug = locale ? `${locale}/${path}` : path

View File

@@ -1,5 +1,4 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import commerce from '@lib/api/commerce'
import { Layout } from '@components/common'
import { Container } from '@components/ui'
@@ -8,7 +7,7 @@ export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
return {
props: { pages },

View File

@@ -1,5 +1,4 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import useCart from '@framework/cart/use-cart'
import usePrice from '@framework/product/use-price'
import commerce from '@lib/api/commerce'
@@ -12,7 +11,7 @@ export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
return {
props: { pages },

View File

@@ -5,14 +5,11 @@ import { ProductCard } from '@components/product'
// import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid'
import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'
import { getConfig } from '@framework/api'
export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const config = { locale }
const { products } = await commerce.getAllProducts({
variables: { first: 12 },
config,

View File

@@ -3,13 +3,12 @@ import commerce from '@lib/api/commerce'
import { Bag } from '@components/icons'
import { Layout } from '@components/common'
import { Container, Text } from '@components/ui'
import { getConfig } from '@framework/api'
export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
return {
props: { pages },

View File

@@ -7,14 +7,13 @@ import { useRouter } from 'next/router'
import commerce from '@lib/api/commerce'
import { Layout } from '@components/common'
import { ProductView } from '@components/product'
import { getConfig } from '@framework/api'
export async function getStaticProps({
params,
locale,
preview,
}: GetStaticPropsContext<{ slug: string }>) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
const { product } = await commerce.getProduct({
variables: { slug: params!.slug },

View File

@@ -1,5 +1,4 @@
import type { GetStaticPropsContext } from 'next'
import { getConfig } from '@framework/api'
import useCustomer from '@framework/customer/use-customer'
import commerce from '@lib/api/commerce'
import { Layout } from '@components/common'
@@ -9,7 +8,7 @@ export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
return {
props: { pages },

View File

@@ -8,7 +8,6 @@ import { Layout } from '@components/common'
import { ProductCard } from '@components/product'
import { Container, Grid, Skeleton } from '@components/ui'
import { getConfig } from '@framework/api'
import useSearch from '@framework/product/use-search'
import commerce from '@lib/api/commerce'
import rangeMap from '@lib/range-map'
@@ -36,7 +35,7 @@ export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
const { categories, brands } = await commerce.getSiteInfo({ config, preview })
return {

View File

@@ -4,7 +4,6 @@ import { Heart } from '@components/icons'
import { Layout } from '@components/common'
import { Text, Container } from '@components/ui'
import { defaultPageProps } from '@lib/defaults'
import { getConfig } from '@framework/api'
import { useCustomer } from '@framework/customer'
import { WishlistCard } from '@components/wishlist'
import useWishlist from '@framework/wishlist/use-wishlist'
@@ -20,7 +19,7 @@ export async function getStaticProps({
}
}
const config = getConfig({ locale })
const config = { locale }
const { pages } = await commerce.getAllPages({ config, preview })
return {
props: {