Skip to content

Commit 3baf08a

Browse files
committed
fix: lint
1 parent fa22569 commit 3baf08a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/apps/copilots/src/pages/copilot-requests/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from '~/libs/ui'
1919
import { profileContext, ProfileContextData, UserRole } from '~/libs/core'
2020
import { EnvironmentConfig } from '~/config'
21+
import { Sort } from '~/apps/admin/src/platform/gamification-admin/src/game-lib'
2122

2223
import { ProjectTypeLabels } from '../../constants'
2324
import { approveCopilotRequest, CopilotRequestsResponse, useCopilotRequests } from '../../services/copilot-requests'
@@ -27,7 +28,6 @@ import { Project } from '../../models/Project'
2728

2829
import { CopilotRequestModal } from './copilot-request-modal'
2930
import styles from './CopilotRequestsPage.module.scss'
30-
import { Sort } from '~/apps/admin/src/platform/gamification-admin/src/game-lib'
3131

3232
const CopilotTableActions: FC<{request: CopilotRequest}> = props => {
3333
const navigate: NavigateFunction = useNavigate()
@@ -140,7 +140,7 @@ const CopilotRequestsPage: FC = () => {
140140
const [sort, setSort] = useState<Sort>({
141141
direction: 'desc',
142142
fieldName: 'createdAt',
143-
});
143+
})
144144

145145
const { profile }: ProfileContextData = useContext(profileContext)
146146
const isAdminOrPM: boolean = useMemo(
@@ -239,8 +239,8 @@ const CopilotRequestsPage: FC = () => {
239239
setSize(size + 1)
240240
}
241241

242-
const onToggleSort = (s: Sort) => {
243-
setSort(s);
242+
function onToggleSort(s: Sort): void {
243+
setSort(s)
244244
}
245245

246246
// header button config

src/apps/copilots/src/services/copilot-requests.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import useSWRInfinite, { SWRInfiniteResponse } from 'swr/infinite'
44
import { EnvironmentConfig } from '~/config'
55
import { xhrGetAsync, xhrPatchAsync, xhrPostAsync } from '~/libs/core'
66
import { buildUrl } from '~/libs/shared/lib/utils/url'
7-
8-
import { CopilotRequest } from '../models/CopilotRequest'
97
import { Sort } from '~/apps/admin/src/platform/gamification-admin/src/game-lib'
108
import { getPaginatedAsync, PaginatedResponse } from '~/libs/core/lib/xhr/xhr-functions/xhr.functions'
119

10+
import { CopilotRequest } from '../models/CopilotRequest'
11+
1212
const baseUrl = `${EnvironmentConfig.API.V5}/projects`
1313
const PAGE_SIZE = 20
1414

@@ -46,7 +46,7 @@ export type CopilotRequestsResponse = {
4646
* @returns {CopilotRequestsResponse} - The response containing copilot requests.
4747
*/
4848
export const useCopilotRequests = (sort: Sort, projectId?: string): CopilotRequestsResponse => {
49-
49+
5050
const getKey = (pageIndex: number, previousPageData: CopilotRequest[]): string | undefined => {
5151
if (previousPageData && previousPageData.length < PAGE_SIZE) return undefined
5252
const url = buildUrl(`${baseUrl}${projectId ? `/${projectId}` : ''}/copilots/requests`)
@@ -55,13 +55,15 @@ export const useCopilotRequests = (sort: Sort, projectId?: string): CopilotReque
5555
`
5656
}
5757

58-
const fetcher = (url: string): Promise<PaginatedResponse<CopilotRequest[]>> => getPaginatedAsync<CopilotRequest[]>(url)
59-
.then((data: any) => {
60-
return {
58+
const fetcher = (
59+
url: string,
60+
): Promise<PaginatedResponse<CopilotRequest[]>> => getPaginatedAsync<CopilotRequest[]>(url)
61+
.then((data: any) => (
62+
{
6163
...data,
6264
data: data.data.map(copilotRequestFactory),
6365
}
64-
})
66+
))
6567

6668
const {
6769
isValidating,

0 commit comments

Comments
 (0)