mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 13:55:23 +02:00
fix: sanitize experiment form data to prevent save failure on empty dates
This commit is contained in:
@@ -66,7 +66,16 @@ const ExperimentForm: React.FC<ExperimentFormProps> = ({
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
await createExperiment(formData);
|
||||
// Sanitize optional fields
|
||||
const submissionData = {
|
||||
...formData,
|
||||
end_date: formData.end_date || undefined,
|
||||
description: formData.description || undefined,
|
||||
hypothesis: formData.hypothesis || undefined,
|
||||
owner: formData.owner || undefined,
|
||||
};
|
||||
|
||||
await createExperiment(submissionData);
|
||||
onSuccess();
|
||||
onClose();
|
||||
} catch (error: any) {
|
||||
|
||||
Reference in New Issue
Block a user