Skip to content

Commit

Permalink
[Fix] 진행중인 토너먼트의 여부에 따라 화면 수정 #1106
Browse files Browse the repository at this point in the history
  • Loading branch information
Junho Jeon committed Nov 24, 2023
1 parent fd2f7a1 commit f74ac15
Showing 1 changed file with 17 additions and 10 deletions.
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

0 comments on commit f74ac15

Please sign in to comment.