);
diff --git a/packages/client/src/pages/quiz-session/ui/QuizLoading.tsx b/packages/client/src/pages/quiz-session/ui/QuizLoading.tsx
index c5240776..beded324 100644
--- a/packages/client/src/pages/quiz-session/ui/QuizLoading.tsx
+++ b/packages/client/src/pages/quiz-session/ui/QuizLoading.tsx
@@ -22,7 +22,7 @@ const QuizLoading = () => {
- 다음 퀴즈로 이동 중 입니다.
+ 데이터를 가져오는 중 입니다.
diff --git a/packages/client/src/shared/api/games/index.ts b/packages/client/src/shared/api/games/index.ts
index e7740c54..5afb8613 100644
--- a/packages/client/src/shared/api/games/index.ts
+++ b/packages/client/src/shared/api/games/index.ts
@@ -7,3 +7,7 @@ export function getPincodeExist(pinCode: string) {
export function checkPincodePossible(pinCode: string) {
return apiClient.get(`/games/${pinCode}/check`);
}
+
+export function checkPincodeStatus(pinCode: string, sid: string) {
+ return apiClient.get(`/games/${pinCode}/sid/${sid}/status`);
+}
diff --git a/packages/client/src/shared/boundary/AsyncBoundary.tsx b/packages/client/src/shared/boundary/AsyncBoundary.tsx
index 475b811a..c6ad2318 100644
--- a/packages/client/src/shared/boundary/AsyncBoundary.tsx
+++ b/packages/client/src/shared/boundary/AsyncBoundary.tsx
@@ -1,16 +1,6 @@
import { Suspense } from 'react';
-import LoadingSpinner from '@/shared/assets/icons/loading-alt-loop.svg?react';
+import QuizLoading from '@/pages/quiz-session/ui/QuizLoading';
export default function AsyncBoundary({ children }: { children: React.ReactNode }) {
- return (
-
-
-
- }
- >
- {children}
-
- );
+ return
}>{children};
}
diff --git a/packages/client/src/shared/utils/cookie.ts b/packages/client/src/shared/utils/cookie.ts
index c2f205b5..cb92702d 100644
--- a/packages/client/src/shared/utils/cookie.ts
+++ b/packages/client/src/shared/utils/cookie.ts
@@ -19,3 +19,7 @@ export function setCookie(name: string, val: any, day?: number) {
document.cookie = `${name}=${value}; path=/`;
}
}
+
+export function deleteCookie(name: string) {
+ document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/`;
+}
diff --git a/packages/server/src/module/game/games/game.gateway.ts b/packages/server/src/module/game/games/game.gateway.ts
index 5eaaea9a..dd87ac68 100644
--- a/packages/server/src/module/game/games/game.gateway.ts
+++ b/packages/server/src/module/game/games/game.gateway.ts
@@ -197,7 +197,7 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
// 퀴즈 데이터 가져오기, 초이스 개수를 알아야하기 위해 -> 이후 초이스 배열 만들어야함
const quizData = JSON.parse(await this.redisService.get(`classId=${classId}`));
console.log('upadate', updatedCurrentOrder);
- const currentQuizData = quizData[updatedCurrentOrder];
+ const currentQuizData = quizData.find((quiz) => quiz.position === updatedCurrentOrder);
const choicesLength = currentQuizData['choices'].length;
const choiceStatus = Object.fromEntries(
@@ -231,14 +231,14 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
const { pinCode } = payload;
const gameInfo = JSON.parse(await this.redisService.get(`gameId=${pinCode}`));
- const { classId, currentOrder, quizMaxNum } = gameInfo;
+ const { classId, currentOrder, quizMaxNum, participantList } = gameInfo;
// TODO:캐싱된 퀴즈를 가져온다. 퀴즈를 생성할 경우, 만들어졌을거라 예상
// 만일 레디스에 퀴즈가 저장되어있지않다면, 퀴즈를 다시 캐싱해오는 로직이 필요할지도.
// 퀴즈 데이터 가져오기 이건 참여자들에게 보여줄려고 get한 데이터
const quizData = JSON.parse(await this.redisService.get(`classId=${classId}`));
- const currentQuizData = quizData[currentOrder];
+ const currentQuizData = quizData.find((quiz) => quiz.position === currentOrder);
const isLast = gameInfo.currentOrder === quizMaxNum ? true : false;
@@ -247,8 +247,10 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
await this.redisService.get(`gameId=${pinCode}:quizId=${currentOrder}`),
);
+ const participantLength = participantList.length;
+
const startTime = quizRedis.startTime;
- return { quizMaxNum, currentQuizData, startTime, isLast };
+ return { quizMaxNum, currentQuizData, startTime, isLast, participantLength };
}
private async storeQuizToRedis(classId: number) {
@@ -467,4 +469,15 @@ export class GameGateway implements OnGatewayConnection, OnGatewayDisconnect {
const { pinCode, message, position } = payload;
this.server.to(pinCode).emit('message', { message, position });
}
+
+ @SubscribeMessage('my info')
+ async handleMyInfo(client: Socket, payload: any) {
+ const { sid } = payload;
+ const sidType = await this.gameService.checkSidType(sid);
+ const key = sidType.type === 'master' ? `master_sid=${sid}` : `participant_sid=${sid}`;
+
+ const { nickname, character } = JSON.parse(await this.redisService.get(key));
+
+ return { nickname, character };
+ }
}