mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-15 15:32:39 -05:00
17 lines
525 B
TypeScript
17 lines
525 B
TypeScript
import useSWR from "swr";
|
|
import type { GetTournamentByOrganizationAndName } from "@sendou-ink/api";
|
|
import { useRouter } from "next/dist/client/router";
|
|
|
|
export function useTournamentData() {
|
|
const router = useRouter();
|
|
const { organization, tournament } = router.query;
|
|
// TODO: date to string
|
|
const result = useSWR<GetTournamentByOrganizationAndName>(
|
|
typeof organization === "string" && typeof tournament === "string"
|
|
? `/tournaments/${organization}/${tournament}`
|
|
: null
|
|
);
|
|
|
|
return result;
|
|
}
|