File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import { apiClient } from '@/shared/lib/apiClient';
33import { CommonResponse } from '@/shared/type/response' ;
44import { GoalFormData } from '@/app/main/create-goal/page' ;
55
6- interface GoalListResponse extends CommonResponse < { goals : Goal [ ] } > { }
6+ interface GoalListResponse extends CommonResponse < Goal [ ] > { }
77
88interface CreateGoalRequest extends GoalFormData { }
99
1010export async function getGoalList ( ) {
1111 const { data } = await apiClient . get < GoalListResponse > ( '/goals' ) ;
12- return data . data . goals ;
12+ return data . data ;
1313}
1414
1515export async function postCreateGoal ( req : CreateGoalRequest ) {
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import Button from '@/shared/components/navigation/Button';
1010
1111export default function MainPage ( ) {
1212 useAutoLogout ( ) ;
13- const { isLoading , goal, fetchGoal } = useFetchGetGoal ( ) ;
13+ const { goal } = useFetchGetGoal ( ) ;
1414 const router = useRouter ( ) ;
1515
1616 return (
@@ -19,8 +19,15 @@ export default function MainPage() {
1919 < div className = "flex flex-col h-screen bg-[#1C1C1E] overflow-hidden p-8" >
2020 < div className = "flex justify-end mb-8" >
2121 < Button size = "ml" text = "목표추가하기" onClick = { ( ) => router . push ( '/main/create-goal' ) } />
22+ < LogoutButton />
2223 </ div >
23- < LogoutButton />
24+ { goal && (
25+ < div className = "flex flex-col" >
26+ < p className = "text-white" > { `목표이름 : ${ goal . name } ` } </ p >
27+ < p className = "text-white" > { `현재 : ${ goal . beforeAfter . asIs } ` } </ p >
28+ < p className = "text-white" > { `미래 : ${ goal . beforeAfter . toBe } ` } </ p >
29+ </ div >
30+ ) }
2431 </ div >
2532 </ div >
2633 ) ;
Original file line number Diff line number Diff line change @@ -37,14 +37,13 @@ export const useFetchPostCreateGoal = (): UseFetchPostCreateGoalReturn => {
3737 // 성공 토스트 메시지가 보인 후 main 페이지로 이동
3838 setTimeout ( ( ) => {
3939 router . push ( '/main' ) ;
40- } , 1500 ) ;
40+ } , 500 ) ;
4141 } catch ( err ) {
4242 setIsError ( true ) ;
4343 const errorMessage = err instanceof Error ? err . message : '목표 생성에 실패했습니다.' ;
4444 setError ( errorMessage ) ;
4545 showToast ( errorMessage , 'error' ) ;
4646 } finally {
47- console . log ( 'ehdwkr' ) ;
4847 setIsLoading ( false ) ;
4948 }
5049 } ;
You can’t perform that action at this time.
0 commit comments