mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 20:02:20 -06:00
fix: Adjusted set in webhook to go empty when enabled false
This commit is contained in:
@@ -8,9 +8,15 @@ export class WebhookController {
|
||||
constructor(private readonly webhookService: WebhookService) {}
|
||||
|
||||
public async createWebhook(instance: InstanceDto, data: WebhookDto) {
|
||||
if (!isURL(data.url, { require_tld: false })) {
|
||||
if (data.enabled && !isURL(data.url, { require_tld: false })) {
|
||||
throw new BadRequestException('Invalid "url" property');
|
||||
}
|
||||
|
||||
if (!data.enabled) {
|
||||
data.url = '';
|
||||
data.events = [];
|
||||
}
|
||||
|
||||
return this.webhookService.create(instance, data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user