2024-12-23 15:40:32 +00:00
|
|
|
"use client";
|
|
|
|
|
import Loader from "@/components/loader";
|
2024-11-26 03:09:48 +00:00
|
|
|
|
2024-12-23 15:40:32 +00:00
|
|
|
import { useMounted } from "@/hooks/use-mounted";
|
|
|
|
|
import React from "react";
|
2024-11-26 03:09:48 +00:00
|
|
|
|
2024-12-24 15:44:47 +00:00
|
|
|
const MountedProvider = ({ children, isProtected }: { children: React.ReactNode, isProtected: Boolean }) => {
|
2024-12-23 15:40:32 +00:00
|
|
|
const mounted = useMounted();
|
2024-12-24 15:44:47 +00:00
|
|
|
if (!mounted) return isProtected ? <Loader /> : null;
|
2024-12-23 15:40:32 +00:00
|
|
|
return children;
|
|
|
|
|
};
|
2024-11-26 03:09:48 +00:00
|
|
|
|
2024-12-23 15:40:32 +00:00
|
|
|
export default MountedProvider;
|