first commit
This commit is contained in:
27
src/components/AuthGuard.tsx
Normal file
27
src/components/AuthGuard.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import {useMe} from "@/hooks";
|
||||
import Loader from "./Loader";
|
||||
|
||||
export default function AuthGuard({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const {isLoading} = useMe();
|
||||
|
||||
|
||||
|
||||
if (isLoading)
|
||||
return (
|
||||
<div className="h-screen flex items-center justify-center w-full">
|
||||
<div className="flex items-center justify-center gap-x-4 mx-auto">
|
||||
<span>لطفا منتظر بمانید</span>
|
||||
<span>
|
||||
<Loader />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
return children;
|
||||
}
|
||||
Reference in New Issue
Block a user