feat(platform): 开源发布 - 初始化 Open AI Canvas

This commit is contained in:
ddCat
2026-07-22 14:18:14 +08:00
commit aea35896eb
365 changed files with 66410 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import type { ReactNode } from "react";
import { Navigate, useLocation } from "react-router";
import { FullScreenLoader } from "@/components/ui/aceternity/full-screen-loader";
import { useUserStore } from "@/stores/use-user-store";
export function RequireAuth({ children }: { children: ReactNode }) {
const location = useLocation();
const hydrated = useUserStore((state) => state.hydrated);
const user = useUserStore((state) => state.user);
if (!hydrated) return <FullScreenLoader />;
if (!user) return <Navigate to={`/login?next=${encodeURIComponent(location.pathname + location.search)}`} replace />;
return children;
}