-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
169 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { | ||
BaseFetchRequestProps, | ||
fetchRequest, | ||
} from '@/services/api/fetchRequest'; | ||
|
||
export interface Response extends API.WithPagination<API.Company> {} | ||
|
||
export interface Params { | ||
query?: string; | ||
type: API.CompanyType; | ||
} | ||
|
||
export default async function req({ | ||
page = 1, | ||
size = 15, | ||
...props | ||
}: BaseFetchRequestProps<Params>): Promise<Response> { | ||
return fetchRequest<Response>({ | ||
...props, | ||
path: `/companies`, | ||
method: 'post', | ||
page, | ||
size, | ||
config: { | ||
next: { | ||
revalidate: 60, | ||
}, | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import getCompanies, { Params } from '@/services/api/companies/getCompanies'; | ||
|
||
const useCompanies = (params: Params) => { | ||
return useQuery({ | ||
queryKey: ['companies', { ...params }], | ||
queryFn: () => | ||
getCompanies({ | ||
params, | ||
}), | ||
}); | ||
}; | ||
|
||
export default useCompanies; |
Oops, something went wrong.