mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-28 22:25:51 -05:00
Use custom Navigate instead of react-router
This commit is contained in:
11
app/components/Navigate.tsx
Normal file
11
app/components/Navigate.tsx
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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"]),
|
||||
|
||||
@@ -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 }];
|
||||
|
||||
Reference in New Issue
Block a user