mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 07:26:59 +00:00
Apply suggestions from code review
Co-authored-by: Luis Alvarez D. <luis@vercel.com>
This commit is contained in:
parent
471813ad83
commit
8909e94a6a
@ -21,7 +21,7 @@
|
||||
}
|
||||
```
|
||||
|
||||
## Refrences:
|
||||
## References
|
||||
- SDK: https://github.com/SalesforceCommerceCloud/commerce-sdk
|
||||
- isomorphic SDK (currently not used atm): https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic
|
||||
- PWA Kit storefront example: https://pwa-kit.mobify-storefront.com/
|
||||
|
@ -10,16 +10,8 @@ const getProducts: ProductsEndpoint['handlers']['getProducts'] = async ({
|
||||
}) => {
|
||||
const { sdk } = config;
|
||||
|
||||
let searchTerm = search;
|
||||
|
||||
if (categoryId) {
|
||||
searchTerm = categoryId as string
|
||||
}
|
||||
|
||||
// set default for main category
|
||||
if (!searchTerm) {
|
||||
searchTerm = 'clothing'
|
||||
}
|
||||
// 'clothing' is our main category default, and a manually set category has priority
|
||||
const searchTerm = categoryId ? categoryId as string : search || 'clothing';
|
||||
|
||||
const searchClient = await sdk.getSearchClient();
|
||||
// use SDK search API for initial products
|
||||
|
Loading…
x
Reference in New Issue
Block a user