Skip to content

Commit 63044fb

Browse files
committed
fix(game): handleResponse 비-null 단언 제거 및 charColors 상수화
- game.ts: data! 단언 제거, !data 시 명시적 에러 throw - GamePage.tsx: 인라인 charColors 배열을 모듈 상수 CHAR_COLORS로 분리해 렌더마다 캔버스 재생성 방지
1 parent bb6f383 commit 63044fb

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

frontend/src/apis/game.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export const postGameClick = async (
1414
response,
1515
'클릭 요청에 실패했습니다.',
1616
);
17-
return data!;
17+
if (!data) throw new Error('클릭 요청에 실패했습니다.');
18+
return data;
1819
};
1920

2021
export const getGameRanking = async (): Promise<GameRankingResponse> => {
@@ -23,5 +24,6 @@ export const getGameRanking = async (): Promise<GameRankingResponse> => {
2324
response,
2425
'랭킹을 불러오는데 실패했습니다.',
2526
);
26-
return data!;
27+
if (!data) throw new Error('랭킹을 불러오는데 실패했습니다.');
28+
return data;
2729
};

frontend/src/pages/GamePage/GamePage.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import * as S from './GamePage.styles';
99

1010
const STORAGE_KEY = 'game_club_name';
1111

12+
const CHAR_COLORS = [
13+
'#FF5414',
14+
'#FFB300',
15+
'#5FD8C0',
16+
'#7094FF',
17+
'#D4537E',
18+
'#EF9F27',
19+
'#FF9D7C',
20+
];
21+
1222
const BLOBS = [
1323
{
1424
size: 320,
@@ -139,15 +149,7 @@ const GamePage = () => {
139149
spacing={4}
140150
dotR={1.8}
141151
hoverRadius={18}
142-
charColors={[
143-
'#FF5414',
144-
'#FFB300',
145-
'#5FD8C0',
146-
'#7094FF',
147-
'#D4537E',
148-
'#EF9F27',
149-
'#FF9D7C',
150-
]}
152+
charColors={CHAR_COLORS}
151153
/>
152154
</motion.div>
153155
)}

0 commit comments

Comments
 (0)