Skip to content

Commit 080a788

Browse files
authored
Merge pull request #36 from DDD-Community/develop
Hotfix / 목표 생성-조회 API URL 수정 및 Response 변경
2 parents 94c4ed1 + a19f0d6 commit 080a788

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

.github/workflows/manual-trigger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515
deploy:
16-
uses: ./.github/workflows/main.yml
16+
uses: /.github/workflows/main.yml
1717
with:
1818
branch: ${{ github.event.inputs.branch }}
1919
secrets: inherit

src/app/main/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { apiClient } from '@/shared/lib/apiClient';
33
import { CommonResponse } from '@/shared/type/response';
44
import { GoalFormData } from '@/app/main/create-goal/page';
55

6-
interface GoalListResponse extends CommonResponse<{ goals: Goal[] }> {}
6+
interface GoalListResponse extends CommonResponse<Goal[]> {}
77

88
interface CreateGoalRequest extends GoalFormData {}
99

1010
export async function getGoalList() {
1111
const { data } = await apiClient.get<GoalListResponse>('/goals');
12-
return data.data.goals;
12+
return data.data;
1313
}
1414

1515
export async function postCreateGoal(req: CreateGoalRequest) {
16-
return await apiClient.post<CreateGoalRequest>('/goal', req);
16+
return await apiClient.post<CreateGoalRequest>('/goals', req);
1717
}

src/app/main/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Button from '@/shared/components/navigation/Button';
1010

1111
export 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
);

src/app/main/useFetchPostCreateGoal.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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
};

0 commit comments

Comments
 (0)