mirror of
https://github.com/christianvidalwolf-prog/CrazeAnalytix.git
synced 2026-08-03 19:25:24 +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);
|
setLoading(true);
|
||||||
try {
|
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();
|
onSuccess();
|
||||||
onClose();
|
onClose();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user