wip
This commit is contained in:
13
src/shared/protected.tsx
Normal file
13
src/shared/protected.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { useAccount } from "@utils/hooks/useAccount";
|
||||
import { ReactNode } from "react";
|
||||
import { Navigate } from "react-router-dom";
|
||||
|
||||
export function Protected({ children }: { children: ReactNode }) {
|
||||
const { status, account } = useAccount();
|
||||
|
||||
if (status === "success" && !account) {
|
||||
return <Navigate to="/auth/welcome" replace />;
|
||||
}
|
||||
|
||||
return children;
|
||||
}
|
||||
Reference in New Issue
Block a user