Skip to content

Commit

Permalink
Implemented sorting categories in popular categories block (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroslavLys authored Jul 5, 2024
1 parent 63ce590 commit 8b4752c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/popular-categories/PopularCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
getScreenBasedLimit,
spliceSx
} from '~/utils/helper-functions'
import { CategoryInterface, ItemsWithCount } from '~/types'
import { CategoryInterface, ItemsWithCount, SortEnum } from '~/types'
import { styles } from '~/components/popular-categories/PopularCategories.styles'

interface PopularCategoriesProps {
Expand All @@ -43,7 +43,11 @@ const PopularCategories: FC<PopularCategoriesProps> = ({
const itemsToShow = getScreenBasedLimit(breakpoints, itemsLoadLimit)

const getCategories = useCallback(
() => categoryService.getCategories({ limit: itemsToShow }),
() =>
categoryService.getCategories({
limit: itemsToShow,
sort: { order: SortEnum.Desc, orderBy: 'totalOffersSum' }
}),
[itemsToShow]
)
const { response, loading } = useAxios<ItemsWithCount<CategoryInterface>>({
Expand Down

0 comments on commit 8b4752c

Please sign in to comment.