File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
apps/client/src/pages/jobPins Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ import apiRequest from '@shared/apis/setting/axiosInstance' ;
2+
3+ export const getJobPinsArticles = async ( page : number , size : number ) => {
4+ const { data } = await apiRequest . get ( '/api/v3/articles/shared/job' , {
5+ params : {
6+ page,
7+ size,
8+ } ,
9+ } ) ;
10+
11+ return data . data ;
12+ } ;
Original file line number Diff line number Diff line change 1+ import { useInfiniteQuery } from '@tanstack/react-query' ;
2+ import { getJobPinsArticles } from './axios' ;
3+
4+ export const useGetJobPinsArticles = ( ) => {
5+ return useInfiniteQuery ( {
6+ queryKey : [ 'jobPinsArticles' ] ,
7+ queryFn : ( { pageParam = 0 } ) => getJobPinsArticles ( pageParam , 20 ) ,
8+ initialPageParam : 0 ,
9+ getNextPageParam : ( lastPage , allPages ) => {
10+ if ( lastPage . articles . length === 0 ) {
11+ return undefined ;
12+ }
13+
14+ return allPages . length ;
15+ } ,
16+ } ) ;
17+ } ;
Original file line number Diff line number Diff line change 1+ export interface JobPinArticle {
2+ url : string ;
3+ title : string ;
4+ thumbnailUrl : string ;
5+ categoryName : string ;
6+ categoryColor : string ;
7+ }
8+
9+ export interface JobPinsResponse {
10+ job : string | null ;
11+ articles : JobPinArticle [ ] ;
12+ }
You can’t perform that action at this time.
0 commit comments