mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-23 11:57:50 -05:00
16 lines
518 B
TypeScript
16 lines
518 B
TypeScript
import type { GetTournamentByOrganizationAndName } from "@sendou-ink/api";
|
|
import { useRouter } from "next/dist/client/router";
|
|
import { useMySWR } from "hooks/useMySWR";
|
|
|
|
export function useTournamentData() {
|
|
const router = useRouter();
|
|
const { organization, tournament } = router.query;
|
|
const result = useMySWR<GetTournamentByOrganizationAndName>(
|
|
typeof organization === "string" && typeof tournament === "string"
|
|
? `/tournaments/${organization}/${tournament}`
|
|
: null
|
|
);
|
|
|
|
return result;
|
|
}
|