tiefen_space_web/app/auth/layout.jsx

25 lines
592 B
JavaScript

"use client";
import React, { useEffect } from "react";
import { checkAuth } from "@/utils/auth";
import { useRouter } from "next/navigation";
import InOtherApp from "@/components/InOtherApp";
export default function AuthLayout({ children }) {
const router = useRouter();
useEffect(() => {
const prepare = async () => {
const isLogined = await checkAuth();
if (isLogined) {
router.replace("/");
}
};
prepare();
}, []);
return (
<section className="flex flex-1 flex-col container">
<InOtherApp />
{children}
</section>
);
}