Skip to content

Commit

Permalink
fix: 본인을 제외한 참가자들의 목록 수정 (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
1eecan authored Nov 29, 2023
1 parent ae03d3f commit 0130f09
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pages/MannerScoreReviewPage/MannerScoreReviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ import { ToggleButton } from './ToggleButton';
export const MannerScoreReviewPage = () => {
const navigate = useNavigate();
const gameId = Number(location.pathname.split('/')[2]);
const { data } = useGameDetailQuery(gameId);
const { data: gameData } = useGameDetailQuery(gameId);
const loginInfo = useLoginInfoStore((state) => state.loginInfo);
const teammateListInfo = data.members.filter(({ id }) => {
const teammateListInfo = gameData.members.filter(({ id }) => {
return loginInfo?.id !== id;
});
const nowDate = new Date();
const gameDate = new Date(`${data.playDate}T${data.playEndTime}`);
const gameDate = new Date(`${gameData.playDate}T${gameData.playEndTime}`);

const exitCode =
nowDate <= gameDate || !loginInfo || teammateListInfo.length === 0;
Expand All @@ -57,7 +57,7 @@ export const MannerScoreReviewPage = () => {
mannerScore: -1 | 0 | 1;
}[]
>(
data.members.map(({ id }) => {
teammateListInfo.map(({ id }) => {
return {
memberId: id,
mannerScore: 0,
Expand All @@ -66,7 +66,9 @@ export const MannerScoreReviewPage = () => {
);

const { mutate } = useMannerScoreReviewPatchMutation({
payload: { mannerScoreReviews: teammateList },
payload: {
mannerScoreReviews: teammateList,
},
gameId: gameId,
});

Expand Down

0 comments on commit 0130f09

Please sign in to comment.