mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
Fixes
This commit is contained in:
parent
9309ca9487
commit
ca703ad2a0
@ -1,9 +1,16 @@
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useSearch, { UseSearch } from '@commerce/product/use-search'
|
||||
import { SearchProductsData, SearchProductsInput } from '@commerce/types'
|
||||
import type { SearchProductsData } from '../api/catalog/products'
|
||||
|
||||
export default useSearch as UseSearch<typeof handler>
|
||||
|
||||
export type SearchProductsInput = {
|
||||
search?: string
|
||||
categoryId?: number
|
||||
brandId?: number
|
||||
sort?: string
|
||||
}
|
||||
|
||||
export const handler: SWRHook<
|
||||
SearchProductsData,
|
||||
SearchProductsInput,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Wishlist as BCWishlist } from '../bigcommerce/api/wishlist'
|
||||
import type { Customer as BCCustomer } from '../bigcommerce/api/customers'
|
||||
import type { SearchProductsData as BCSearchProductsData } from '../bigcommerce/api/catalog/products'
|
||||
|
||||
export type Discount = {
|
||||
// The value of the discount, can be an amount or percentage
|
||||
@ -96,18 +97,8 @@ export interface Wishlist extends BCWishlist {}
|
||||
// TODO: Properly define this type
|
||||
export interface Customer extends BCCustomer {}
|
||||
|
||||
export type SearchProductsData = {
|
||||
products: Product[]
|
||||
found: boolean
|
||||
}
|
||||
|
||||
export type SearchProductsInput = {
|
||||
search?: string
|
||||
categoryId?: string
|
||||
brandId?: string
|
||||
sort?: string
|
||||
locale?: string
|
||||
}
|
||||
// TODO: Properly define this type
|
||||
export interface SearchProductsData extends BCSearchProductsData {}
|
||||
|
||||
/**
|
||||
* Cart mutations
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import { Product } from '@commerce/types'
|
||||
import useSearch, { UseSearch } from '@commerce/product/use-search'
|
||||
import { SearchProductsInput, SearchProductsData } from '@commerce/types'
|
||||
|
||||
import { ProductEdge } from '../schema'
|
||||
|
||||
import {
|
||||
@ -11,6 +10,19 @@ import {
|
||||
normalizeProduct,
|
||||
} from '../utils'
|
||||
|
||||
export type SearchProductsInput = {
|
||||
search?: string
|
||||
categoryId?: string
|
||||
brandId?: string
|
||||
sort?: string
|
||||
locale?: string
|
||||
}
|
||||
|
||||
export type SearchProductsData = {
|
||||
products: Product[]
|
||||
found: boolean
|
||||
}
|
||||
|
||||
export default useSearch as UseSearch<typeof handler>
|
||||
|
||||
export const handler: SWRHook<
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SearchProductsInput } from '@framework/product/use-search'
|
||||
import getSortVariables from './get-sort-variables'
|
||||
import type { SearchProductsInput } from '@commerce/types'
|
||||
|
||||
export const getSearchVariables = ({
|
||||
brandId,
|
||||
|
@ -23,14 +23,14 @@ export async function getStaticProps({
|
||||
})
|
||||
|
||||
// const { categories, brands } = await getSiteInfo({ config, preview })
|
||||
// const { pages } = await getAllPages({ config, preview })
|
||||
const { pages } = await getAllPages({ config, preview })
|
||||
|
||||
return {
|
||||
props: {
|
||||
products,
|
||||
categories: [],
|
||||
brands: [],
|
||||
pages: [],
|
||||
pages,
|
||||
},
|
||||
revalidate: 14400,
|
||||
}
|
||||
|
@ -81,7 +81,9 @@ export default function Search({
|
||||
categoryId: activeCategory?.entityId,
|
||||
brandId: (activeBrand as any)?.entityId,
|
||||
sort: typeof sort === 'string' ? sort : '',
|
||||
...(process.env.COMMERCE_PROVIDER === 'shopify' && {
|
||||
locale,
|
||||
}),
|
||||
})
|
||||
|
||||
const handleClick = (event: any, filter: string) => {
|
||||
|
@ -22,8 +22,8 @@
|
||||
"@components/*": ["components/*"],
|
||||
"@commerce": ["framework/commerce"],
|
||||
"@commerce/*": ["framework/commerce/*"],
|
||||
"@framework": ["framework/vendure"],
|
||||
"@framework/*": ["framework/vendure/*"]
|
||||
"@framework": ["framework/bigcommerce"],
|
||||
"@framework/*": ["framework/bigcommerce/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user