fixed so only Projects can be created in production, so DB is safe from being saturated in production

This commit is contained in:
vadi25 2025-07-16 20:24:16 +02:00
parent e7344d9120
commit 6e3a9ec7ec
1 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import { toast } from "sonner";
import { useMediaStore } from "./media-store";
import { useTimelineStore } from "./timeline-store";
import { generateUUID } from "@/lib/utils";
import { env } from "@/env";
interface ProjectStore {
activeProject: TProject | null;
@ -36,6 +37,16 @@ export const useProjectStore = create<ProjectStore>((set, get) => ({
isInitialized: false,
createNewProject: async (name: string) => {
try {
if (process.env.NODE_ENV !== "development") {
toast.error("Project creation is disabled outside development environment");
throw new Error("Not allowed in production");
}
} catch (error) {
toast.error("Failed to create new project");
throw error;
}
const newProject: TProject = {
id: generateUUID(),
name,