I see this error with the app, reported by NextJS, please fix it. The er

This commit is contained in:
Leon Serfaty G
2025-09-01 06:56:28 +00:00
parent 348c4cf949
commit 87c5d67fa7
3 changed files with 10 additions and 0 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+10
View File
@@ -83,6 +83,16 @@ export async function saveFlow(prevState: State, formData: FormData): Promise<St
);
stmt.run(name, description || null, path, id);
} else {
// Check if path is unique before inserting
const checkStmt = db.prepare('SELECT id FROM flows WHERE path = ?');
const existing = checkStmt.get(path);
if (existing) {
return {
success: false,
message: 'A flow with this path already exists.',
errors: [{ path: ['path'], message: 'A flow with this path already exists.', code: 'custom' }],
};
}
// Create new flow
const stmt = db.prepare(
'INSERT INTO flows (name, description, path) VALUES (?, ?, ?)'