tiefen_space_web/app/auth/layout.jsx

25 lines
592 B
React
Raw Normal View History

2024-01-03 01:07:16 +08:00
"use client";
import React, { useEffect } from "react";
import { checkAuth } from "@/utils/auth";
import { useRouter } from "next/navigation";
2024-01-05 23:30:44 +08:00
import InOtherApp from "@/components/InOtherApp";
2024-01-03 01:07:16 +08:00
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>
);
}