+
diff --git a/src/guard/index.tsx b/src/guard/index.tsx
new file mode 100644
index 0000000..3a552e2
--- /dev/null
+++ b/src/guard/index.tsx
@@ -0,0 +1,19 @@
+import { PropsWithChildren, useEffect } from "react"
+import { useNavigate } from "react-router-dom"
+
+export const Guard = ({ children }: PropsWithChildren) => {
+ const navigate = useNavigate()
+ const token = window.localStorage.getItem("token")
+
+ useEffect(() => {
+ if (!token || token?.length <= 0 || token === undefined || token === null) {
+ navigate("/auth/login")
+ }
+ }, [token , navigate])
+
+ return (
+ <>
+ {children}
+ >
+ )
+}
\ No newline at end of file
diff --git a/src/router/index.tsx b/src/router/index.tsx
index 6e3ec8a..5e8bbd5 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -17,11 +17,12 @@ import { TransactionsPage } from "../pages/dashboard/transactions";
import { ScorePage } from "../pages/dashboard/score";
import { SubscriptionReportPage } from "../pages/dashboard/subscription-report";
import { AwardsPage } from "../pages/dashboard/awards";
+import { Guard } from "../guard";
export const router = createBrowserRouter([
{
- element:
,
+ element:
,
path: "/",
children: [
{