Skip to content

Commit 24a8427

Browse files
committed
Fix warnings
1 parent 9ae828a commit 24a8427

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

frontend/src/components/NoDirectAccessRoutes/index.tsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
import { Navigate, Outlet, useLocation, useNavigate } from "react-router-dom";
2-
import React from "react";
3-
4-
export const useAppNavigate = () => {
5-
const navigate = useNavigate();
6-
7-
const appNavigate = (path: string) => {
8-
navigate(path, {
9-
replace: location.pathname !== "/home",
10-
state: { from: "app-navigation" },
11-
});
12-
};
13-
14-
return appNavigate;
15-
};
1+
import { Navigate, Outlet, useLocation } from "react-router-dom";
162

173
const NoDirectAccessRoutes: React.FC = () => {
184
const location = useLocation();
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { useNavigate } from "react-router-dom";
2+
3+
export const useAppNavigate = () => {
4+
const navigate = useNavigate();
5+
6+
const appNavigate = (path: string) => {
7+
navigate(path, {
8+
replace: location.pathname !== "/home",
9+
state: { from: "app-navigation" },
10+
});
11+
};
12+
13+
return appNavigate;
14+
};
15+
16+
export default useAppNavigate;

frontend/src/contexts/MatchContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
} from "../utils/constants";
1414
import { useAuth } from "./AuthContext";
1515
import { toast } from "react-toastify";
16-
import { useAppNavigate } from "../components/NoDirectAccessRoutes";
16+
import useAppNavigate from "../components/UseAppNavigate";
1717

1818
type MatchUser = {
1919
id: string;

0 commit comments

Comments
 (0)