@@ -6,10 +6,12 @@ import type {
66 AiRecommendSubGoalRequest ,
77 AiRecommendSubGoalResponse ,
88} from './type/aiRecommendSubGoal' ;
9+ import type { UpdateSubGoalRequest } from './type/updateSubGoal.request' ;
910
10- import { get , post } from '@/api' ;
11+ import { get , post , api } from '@/api' ;
1112import { END_POINT } from '@/api/constant/endPoint' ;
1213import type { BaseResponse } from '@/type/api' ;
14+ import axiosInstance from '@/api/axiosInstance' ;
1315
1416export const getCoreGoals = async ( mandalartId : number ) => {
1517 const { data } = await get < BaseResponse < GetCoreGoalsResponse > > (
@@ -83,3 +85,16 @@ export const postAiRecommendSubGoals = async (
8385 const { data } = await post ( `/core-goals/${ coreGoalSnapshotId } /sub-goals/ai` , { goals } ) ;
8486 return data ;
8587} ;
88+
89+ export const updateSubGoal = async ( subGoalId : number , payload : UpdateSubGoalRequest ) => {
90+ return ( await api . patch ( `/sub-goals/${ subGoalId } ` , payload ) ) . data ;
91+ } ;
92+
93+ export const deleteSubGoal = async ( subGoalId : number ) => {
94+ return ( await api . delete ( `/sub-goals/${ subGoalId } ` ) ) . data ;
95+ } ;
96+
97+ export const getOverallGoal = async ( mandalartId : number ) : Promise < { title : string } > => {
98+ const response = await axiosInstance . get ( `/mandalarts/${ mandalartId } ` ) ;
99+ return response . data . data ;
100+ } ;
0 commit comments