File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed
Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ export const postSignUp = async (responsedata: postSignUpRequest) => {
4040 return data ;
4141} ;
4242
43+ export const getArticleDetail = async ( articleId : number ) => {
44+ const { data } = await apiRequest . get ( `/api/v1/articles/${ articleId } ` ) ;
45+ return data ;
46+ } ;
47+
4348export const putEditArticle = async (
4449 articleId : number ,
4550 editArticleData : EditArticleRequest
Original file line number Diff line number Diff line change @@ -6,14 +6,16 @@ import {
66 postSignUpRequest ,
77 putEditArticle ,
88 putCategory ,
9+ getArticleDetail ,
10+ getAcorns ,
911} from '@shared/apis/axios' ;
1012import { AxiosError } from 'axios' ;
1113import {
1214 DashboardCategoriesResponse ,
1315 AcornsResponse ,
1416 EditArticleRequest ,
17+ ArticleDetailResponse ,
1518} from '@shared/types/api' ;
16- import { getAcorns } from './axios' ;
1719
1820export const useGetDashboardCategories = ( ) : UseQueryResult <
1921 DashboardCategoriesResponse ,
@@ -62,6 +64,16 @@ export const usePostSignUp = () => {
6264 } ) ;
6365} ;
6466
67+ export const useGetArticleDetail = (
68+ articleId : number
69+ ) : UseQueryResult < ArticleDetailResponse , AxiosError > => {
70+ return useQuery ( {
71+ queryKey : [ 'articleDetail' , articleId ] ,
72+ queryFn : ( ) => getArticleDetail ( articleId ) ,
73+ enabled : ! ! articleId ,
74+ } ) ;
75+ } ;
76+
6577export const usePutEditArticle = ( ) => {
6678 return useMutation ( {
6779 mutationFn : ( {
Original file line number Diff line number Diff line change @@ -19,3 +19,18 @@ export interface EditArticleRequest {
1919 now : string ;
2020 remindTime : string ;
2121}
22+
23+ interface CategoryResponse {
24+ categoryId : number ;
25+ categoryName : string ;
26+ categoryColor : string ;
27+ }
28+
29+ export interface ArticleDetailResponse {
30+ id : number ;
31+ url : string ;
32+ memo : string ;
33+ remindAt : string ;
34+ createdAt : string ;
35+ categoryResponse : CategoryResponse ;
36+ }
You can’t perform that action at this time.
0 commit comments