I see this error with the app, reported by NextJS, please fix it. The er
This commit is contained in:
@@ -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 (?, ?, ?)'
|
||||
|
||||
Reference in New Issue
Block a user