File tree Expand file tree Collapse file tree 4 files changed +29
-10
lines changed
apps/client/src/pages/jobPins Expand file tree Collapse file tree 4 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ const JobPins = () => {
4747 >
4848 { articlesToDisplay . map ( ( article ) => (
4949 < Card
50- key = { article . id }
50+ key = { article . articleId }
5151 type = "bookmark"
5252 variant = "save"
5353 title = { article . title }
5454 imageUrl = { article . thumbnailUrl }
5555 content = { article . memo }
56- category = { article . categoryName }
57- categoryColor = { article . categoryColor }
56+ category = { article . category . categoryName }
57+ categoryColor = { article . category . categoryColor }
5858 nickname = { article . ownerName }
5959 onClick = { ( ) => window . open ( article . url , '_blank' ) }
6060 />
Original file line number Diff line number Diff line change 11import apiRequest from '@shared/apis/setting/axiosInstance' ;
2+ import { JobPinsResponse } from '@pages/jobPins/types/api' ;
23
3- export const getJobPinsArticles = async ( page : number , size : number ) => {
4+ interface ApiResponse < T > {
5+ code : string ;
6+ message : string ;
7+ data : T ;
8+ }
9+
10+ export const getJobPinsArticles = async (
11+ page : number ,
12+ size : number
13+ ) : Promise < JobPinsResponse > => {
414 const { data } = await apiRequest . get ( '/api/v3/articles/shared/job' , {
515 params : {
616 page,
717 size,
818 } ,
919 } ) ;
1020
11- return data . data ;
21+ return ( data as ApiResponse < JobPinsResponse > ) . data ;
1222} ;
Original file line number Diff line number Diff line change 11import { useInfiniteQuery } from '@tanstack/react-query' ;
2+ import { JobPinsResponse } from '@pages/jobPins/types/api' ;
23import { getJobPinsArticles } from './axios' ;
34
45export const useGetJobPinsArticles = ( ) => {
5- return useInfiniteQuery ( {
6+ return useInfiniteQuery < JobPinsResponse > ( {
67 queryKey : [ 'jobPinsArticles' ] ,
7- queryFn : ( { pageParam = 0 } ) => getJobPinsArticles ( pageParam , 20 ) ,
8+ queryFn : ( { pageParam = 0 } ) => getJobPinsArticles ( pageParam as number , 20 ) ,
89 initialPageParam : 0 ,
910 getNextPageParam : ( lastPage , allPages ) => {
1011 if ( lastPage . articles . length === 0 ) {
Original file line number Diff line number Diff line change 1- export interface JobPinArticle {
1+ interface JobPinCategory {
2+ categoryId : number ;
3+ categoryName : string ;
4+ categoryColor : string ;
5+ }
6+
7+ interface JobPinArticle {
8+ articleId : number ;
29 url : string ;
310 title : string ;
411 thumbnailUrl : string ;
5- categoryName : string ;
6- categoryColor : string ;
12+ memo : string ;
13+ ownerName : string ;
14+ category : JobPinCategory ;
715}
816
917export interface JobPinsResponse {
You can’t perform that action at this time.
0 commit comments