mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
Changed import
This commit is contained in:
parent
012f4b052f
commit
35c5b1b4a3
@ -1,7 +1,7 @@
|
|||||||
import type { LoginOperation } from '../types/login'
|
import type { LoginOperation } from '../types/login'
|
||||||
import type { GetAllPagesOperation } from '../types/page'
|
import type { GetAllPagesOperation } from '../types/page'
|
||||||
import type { ServerResponse } from 'http'
|
import type { ServerResponse } from 'http'
|
||||||
import type { APIProvider, CommerceAPI, CommerceAPICore } from '.'
|
import type { APIProvider, CommerceAPI } from '.'
|
||||||
|
|
||||||
const noop = () => {
|
const noop = () => {
|
||||||
throw new Error('Not implemented')
|
throw new Error('Not implemented')
|
||||||
|
@ -5,11 +5,11 @@ import type {
|
|||||||
} from 'next'
|
} from 'next'
|
||||||
import { Text } from '@components/ui'
|
import { Text } from '@components/ui'
|
||||||
import { Layout } from '@components/common'
|
import { Layout } from '@components/common'
|
||||||
|
import commerce from '@lib/api/commerce'
|
||||||
import getSlug from '@lib/get-slug'
|
import getSlug from '@lib/get-slug'
|
||||||
import { missingLocaleInPages } from '@lib/usage-warns'
|
import { missingLocaleInPages } from '@lib/usage-warns'
|
||||||
import { getConfig } from '@framework/api'
|
import { getConfig } from '@framework/api'
|
||||||
import getPage from '@framework/common/get-page'
|
import getPage from '@framework/common/get-page'
|
||||||
import getAllPages from '@framework/common/get-all-pages'
|
|
||||||
import { defaultPageProps } from '@lib/defaults'
|
import { defaultPageProps } from '@lib/defaults'
|
||||||
|
|
||||||
export async function getStaticProps({
|
export async function getStaticProps({
|
||||||
@ -18,7 +18,7 @@ export async function getStaticProps({
|
|||||||
locale,
|
locale,
|
||||||
}: GetStaticPropsContext<{ pages: string[] }>) {
|
}: GetStaticPropsContext<{ pages: string[] }>) {
|
||||||
const config = getConfig({ locale })
|
const config = getConfig({ locale })
|
||||||
const { pages } = await getAllPages({ preview, config })
|
const { pages } = await commerce.getAllPages({ preview, config })
|
||||||
const path = params?.pages.join('/')
|
const path = params?.pages.join('/')
|
||||||
const slug = locale ? `${locale}/${path}` : path
|
const slug = locale ? `${locale}/${path}` : path
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ export async function getStaticProps({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticPaths({ locales }: GetStaticPathsContext) {
|
export async function getStaticPaths({ locales }: GetStaticPathsContext) {
|
||||||
const { pages } = await getAllPages()
|
const { pages } = await commerce.getAllPages()
|
||||||
const [invalidPaths, log] = missingLocaleInPages()
|
const [invalidPaths, log] = missingLocaleInPages()
|
||||||
const paths = pages
|
const paths = pages
|
||||||
.map((page) => page.url)
|
.map((page) => page.url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user