Files
multitenant-ecommerce/src/modules/products/search-params.ts
T
2025-07-26 10:43:08 +07:00

18 lines
588 B
TypeScript

import { createLoader, parseAsString, parseAsArrayOf, parseAsStringLiteral } from 'nuqs/server';
export const sortValues = ['curated', 'trending', 'hot_and_new'] as const;
const params = {
sort: parseAsStringLiteral(sortValues).withDefault('curated'),
minPrice: parseAsString.withOptions({
clearOnDefault: true
}).withDefault(''),
maxPrice: parseAsString.withOptions({
clearOnDefault: true,
}).withDefault(''),
tags: parseAsArrayOf(parseAsString).withOptions({
clearOnDefault: true,
}).withDefault([])
}
export const loadProductFilters = createLoader(params);