Skip to content

Commit

Permalink
chore: move sortingtype to enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Usmanfee committed Oct 10, 2024
1 parent b35943f commit 952b257
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/pages/ServiceMarketplace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
import SortImage from 'components/shared/frame/SortImage'
import { ServiceTypeIdsEnum } from 'features/serviceManagement/apiSlice'
import NoItems from '../NoItems'
import { SORTING_TYPE } from 'types/Constants'

dayjs.extend(isToday)
dayjs.extend(isYesterday)
Expand All @@ -71,7 +72,9 @@ export default function ServiceMarketplace() {
const [serviceTypeId, setServiceTypeId] = useState<ServiceTypeIdsEnum | ''>(
''
)
const [sortingType, setSortingType] = useState<string>('ReleaseDateDesc')
const [sortingType, setSortingType] = useState<SORTING_TYPE>(
SORTING_TYPE.RELEASE_DATE_DESC
)
const [argsData, setArgsData] = useState<{
page: number
serviceType: ServiceTypeIdsEnum | ''
Expand Down Expand Up @@ -182,7 +185,7 @@ export default function ServiceMarketplace() {

const setSortOptionFn = useCallback((value: string) => {
if (value === 'provider') {
setSortingType('ProviderDesc')
setSortingType(SORTING_TYPE.PROVIDER_DESC)
}
setSortOption(value)
setShowModal(false)
Expand Down
5 changes: 5 additions & 0 deletions src/types/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,8 @@ export enum HINTS {
COMING_SOON = 'coming_soon',
NEW = 'new',
}

export enum SORTING_TYPE {
RELEASE_DATE_DESC = 'ReleaseDateDesc',
PROVIDER_DESC = 'ProviderDesc',
}

0 comments on commit 952b257

Please sign in to comment.