mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
Allow setting a taxon id for getAllProducts
This commit is contained in:
13
framework/spree/utils/validate-all-products-taxonomy-id.ts
Normal file
13
framework/spree/utils/validate-all-products-taxonomy-id.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
const validateAllProductsTaxonomyId = (taxonomyId: unknown): string | false => {
|
||||
if (!taxonomyId || taxonomyId === 'false') {
|
||||
return false
|
||||
}
|
||||
|
||||
if (typeof taxonomyId === 'string') {
|
||||
return taxonomyId
|
||||
}
|
||||
|
||||
throw new TypeError('taxonomyId must be a string or falsy.')
|
||||
}
|
||||
|
||||
export default validateAllProductsTaxonomyId
|
Reference in New Issue
Block a user