Skip to content

Commit

Permalink
Connected to db
Browse files Browse the repository at this point in the history
  • Loading branch information
lille-morille committed Apr 15, 2024
1 parent d26f846 commit 6907a6b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions app/hooks/useTournament.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { Tournament } from '@/app/api/tournament';
import {
PongMatch,
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 8 additions & 4 deletions app/tournament/[id]/page.tsx → app/tournament/[pin]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { useTournament } from '../../hooks/useTournament';
'use client';

import { useTournament, useTournamentByPin } from '../../hooks/useTournament';
import Before from './before';
import ResultsPage from './results';

interface TournamentPageProps {
params: {
id: string;
pin: string;
};
}

export default function TournamentPage(props: TournamentPageProps) {
const { data: tournament, isLoading } = useTournament(props.params.id);
const { data: tournaments, isLoading } = useTournamentByPin(props.params.pin);

if (isLoading || !tournament) {
if (isLoading || !tournaments.length) {
return <div>Loading...</div>;
}

const tournament = tournaments[0];

if (tournament.status === 'PENDING') {
return <Before tournament={tournament} />;
} else if (tournament.status === 'ACTIVE') {
Expand Down
File renamed without changes.

0 comments on commit 6907a6b

Please sign in to comment.