File tree Expand file tree Collapse file tree 3 files changed +41
-6
lines changed
Expand file tree Collapse file tree 3 files changed +41
-6
lines changed Original file line number Diff line number Diff line change 11import apiRequest from '@shared/apis/setting/axiosInstance' ;
2+ import { EditArticleRequest } from '@shared/types/api' ;
23import { formatLocalDateTime } from '@shared/utils/formatDateTime' ;
34
45export const getDashboardCategories = async ( ) => {
@@ -29,12 +30,22 @@ export const getAcorns = async () => {
2930} ;
3031
3132export interface postSignUpRequest {
32- email : string ,
33- remindDefault : string ,
34- fcmToken : string
33+ email : string ;
34+ remindDefault : string ;
35+ fcmToken : string ;
3536}
3637
3738export const postSignUp = async ( responsedata : postSignUpRequest ) => {
38- const { data} = await apiRequest . post ( '/api/v1/auth/signup' , responsedata ) ;
39+ const { data } = await apiRequest . post ( '/api/v1/auth/signup' , responsedata ) ;
3940 return data ;
40- } ;
41+ } ;
42+
43+ export const putEditArticle = async (
44+ articleId : number ,
45+ editArticleData : EditArticleRequest
46+ ) => {
47+ const response = await apiRequest . put ( `/api/v1/articles/${ articleId } ` , {
48+ editArticleData,
49+ } ) ;
50+ return response ;
51+ } ;
Original file line number Diff line number Diff line change @@ -4,10 +4,15 @@ import {
44 postCategory ,
55 postSignUp ,
66 postSignUpRequest ,
7+ putEditArticle ,
78 putCategory ,
89} from '@shared/apis/axios' ;
910import { AxiosError } from 'axios' ;
10- import { DashboardCategoriesResponse , AcornsResponse } from '@shared/types/api' ;
11+ import {
12+ DashboardCategoriesResponse ,
13+ AcornsResponse ,
14+ EditArticleRequest ,
15+ } from '@shared/types/api' ;
1116import { getAcorns } from './axios' ;
1217
1318export const useGetDashboardCategories = ( ) : UseQueryResult <
@@ -56,3 +61,15 @@ export const usePostSignUp = () => {
5661 } ,
5762 } ) ;
5863} ;
64+
65+ export const usePutEditArticle = ( ) => {
66+ return useMutation ( {
67+ mutationFn : ( {
68+ articleId,
69+ editArticleData,
70+ } : {
71+ articleId : number ;
72+ editArticleData : EditArticleRequest ;
73+ } ) => putEditArticle ( articleId , editArticleData ) ,
74+ } ) ;
75+ } ;
Original file line number Diff line number Diff line change @@ -12,3 +12,10 @@ export type AcornsResponse = {
1212 acornCount : number ;
1313 remindDateTime : string ;
1414} ;
15+
16+ export interface EditArticleRequest {
17+ categoryId : number ;
18+ memo : string ;
19+ now : string ;
20+ remindTime : string ;
21+ }
You can’t perform that action at this time.
0 commit comments