mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
32 lines
583 B
TypeScript
32 lines
583 B
TypeScript
export const getSortVariables = (sort?: string, isCategory: boolean = false) => {
|
|
let output = {}
|
|
switch (sort) {
|
|
case 'price-asc':
|
|
output = {
|
|
field: 'PRICE',
|
|
direction: 'ASC'
|
|
}
|
|
break
|
|
case 'price-desc':
|
|
output = {
|
|
field: 'PRICE',
|
|
direction: 'DESC',
|
|
}
|
|
break
|
|
case 'trending-desc':
|
|
output = {
|
|
field: 'RANK',
|
|
direction: 'DESC',
|
|
}
|
|
break
|
|
case 'latest-desc':
|
|
output = {
|
|
field: 'DATE',
|
|
direction: 'DESC'
|
|
}
|
|
break
|
|
}
|
|
return output
|
|
}
|
|
|