mirror of
https://github.com/Nezumi-2711/multitenant-ecommerce.git
synced 2026-09-22 20:01:36 +00:00
feat: implement filter feature
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user