Skip to content

Commit c25229d

Browse files
fix: 체형 정보 조회 API 반환 타입을 discriminated union으로 수정
Co-authored-by: aider (deepseek/deepseek-chat) <aider@aider.chat>
1 parent 9fdad0a commit c25229d

1 file changed

Lines changed: 20 additions & 13 deletions

File tree

src/app/actions/body-info.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,32 @@ export async function getBodyInfoTermsAction(): Promise<{
4747
/**
4848
* [GET] 내 체형 정보 조회
4949
*/
50-
export async function getMyBodyInfoAction(): Promise<{
51-
success: boolean;
52-
data?: BodyInfoSchemaType & { hasBodyInfo: boolean };
53-
message?: string;
54-
}> {
50+
export async function getMyBodyInfoAction(): Promise<
51+
| {
52+
success: true;
53+
data: BodyInfoSchemaType & { hasBodyInfo: true };
54+
message?: string;
55+
}
56+
| {
57+
success: true;
58+
data?: undefined;
59+
hasBodyInfo: false;
60+
message?: string;
61+
}
62+
| {
63+
success: false;
64+
data?: undefined;
65+
message: string;
66+
}
67+
> {
5568
try {
5669
const response = await api.get<MyBodyInfoResponse>('/users/me/body-info');
5770

5871
if (!response || !response.hasBodyInfo) {
5972
return {
6073
success: true,
61-
data: {
62-
hasBodyInfo: false,
63-
height: 0,
64-
weight: 0,
65-
usualTopSize: '',
66-
usualBottomSize: '',
67-
usualShoeSize: '',
68-
},
74+
data: undefined,
75+
hasBodyInfo: false,
6976
};
7077
}
7178

0 commit comments

Comments
 (0)