Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/토너먼트 참가신청 취소#1106 #1127

Merged
merged 12 commits into from
Nov 30, 2023
Prev Previous commit
Next Next commit
[Fix] 진행중인 토너먼트의 여부에 따라 화면 수정 #1106
  • Loading branch information
Junho Jeon committed Nov 24, 2023
commit f74ac156cd7dd0cbdd11dc1f627d3d198da85733
27 changes: 17 additions & 10 deletions pages/tournament.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { useQuery } from 'react-query';
import { useSetRecoilState } from 'recoil';
import { TournamentInfo } from 'types/tournamentTypes';
import { TournamentInfo , TournamentData } from 'types/tournamentTypes';
import { instance } from 'utils/axios';
import { InfiniteScroll } from 'utils/infinityScroll';
import { mockInstance } from 'utils/mockAxios';
Expand All @@ -12,14 +13,14 @@ import styles from 'styles/tournament/TournamentContainer.module.scss';
export default function Tournament() {
const setError = useSetRecoilState(errorState);

// const Info = useQuery<TournamentInfo>(
// 'openTorunamentInfo',
// () =>
// mockInstance
// .get('tournament?page=1&status=진행중')
// .then((res) => res.data),
// { retry: 1, staleTime: 60000 /* 60초 */ }
// );
const openInfo = useQuery<TournamentData>(
'openTorunamentInfo',
() =>
mockInstance
.get('tournament?page=1&status=진행중')
.then((res) => res.data),
{ retry: 1, staleTime: 60000 /* 60초 */ }
);

async function fetchWaitTournamentData(page: number) {
return await mockInstance
Expand Down Expand Up @@ -62,7 +63,13 @@ export default function Tournament() {
</div>
<div className={styles.tournamentTextOpen}> 진행중인 토너먼트 </div>
<div className={styles.openTournamentBox}>
<div className={styles.tournamentText}> 무언가 토너먼트의 사진 </div>
<div className={styles.tournamentText}>
{openInfo.data && openInfo.data.tournaments.length === 0 ? (
<>진행중인 토너먼트가 없습니다</>
) : (
<>진행중인 토너먼트 사진</>
)}
</div>
</div>
</div>
</div>
Expand Down