fix campaign template cant be both SMTP and API Sender set

Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
Ronni Skansing
2025-11-21 10:45:53 +01:00
parent 6368e3b7ee
commit 5a6a15e162
2 changed files with 16 additions and 0 deletions
+9
View File
@@ -125,6 +125,15 @@ func (c *CampaignTemplate) Validate() error {
)
}
// validate that smtp configuration and api sender are mutually exclusive
_, errSMTP := c.SMTPConfigurationID.Get()
_, errAPISender := c.APISenderID.Get()
if errSMTP == nil && errAPISender == nil {
return errs.NewValidationError(
errors.New("smtp configuration and api sender cannot both be set"),
)
}
return nil
}
@@ -101,6 +101,13 @@
modalText = getModalText('template', modalMode);
}
// clear smtp or api sender when switching template type
$: if (formValues.templateType === 'Email') {
formValues.apiSender = null;
} else if (formValues.templateType === 'External API') {
formValues.smtpConfiguration = null;
}
// hooks
onMount(() => {
const context = appStateService.getContext();