diff --git a/app/components/Navigate.tsx b/app/components/Navigate.tsx new file mode 100644 index 000000000..316fa3417 --- /dev/null +++ b/app/components/Navigate.tsx @@ -0,0 +1,11 @@ +import { useNavigate } from "@remix-run/react"; +import * as React from "react"; + +export function Navigate({ to }: { to: string }) { + const navigate = useNavigate(); + React.useEffect(() => { + navigate(to); + }, [navigate, to]); + + return null; +} diff --git a/app/routes/to/$organization.$tournament/manage.tsx b/app/routes/to/$organization.$tournament/manage.tsx index 11a637824..5fe1aacb3 100644 --- a/app/routes/to/$organization.$tournament/manage.tsx +++ b/app/routes/to/$organization.$tournament/manage.tsx @@ -24,8 +24,8 @@ import { import manageStylesUrl from "~/styles/tournament-manage.css"; import { parseRequestFormData, requireUser, Unpacked, validate } from "~/utils"; import { useUser } from "~/hooks/common"; -import { Navigate } from "react-router"; import { tournamentFrontPage } from "~/utils/urls"; +import { Navigate } from "~/components/Navigate"; const manageActionSchema = z.object({ _action: z.enum(["CHECK_OUT", "CHECK_IN", "UNREGISTER"]), diff --git a/app/routes/to/$organization.$tournament/register.tsx b/app/routes/to/$organization.$tournament/register.tsx index 5b92e875a..71fd354f5 100644 --- a/app/routes/to/$organization.$tournament/register.tsx +++ b/app/routes/to/$organization.$tournament/register.tsx @@ -20,8 +20,8 @@ import { parseRequestFormData, requireUser } from "~/utils"; import { tournamentFrontPage, tournamentManageTeamPage } from "~/utils/urls"; import * as TournamentTeam from "~/models/TournamentTeam.server"; import { FindTournamentByNameForUrlI } from "~/services/tournament"; -import { Navigate } from "react-router"; import { PleaseLogin } from "~/components/PleaseLogin"; +import { Navigate } from "~/components/Navigate"; export const links: LinksFunction = () => { return [{ rel: "stylesheet", href: styles }];