diff --git a/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts b/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts index 33dfb12..31d15e6 100644 --- a/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts +++ b/ogWebconsole/src/app/components/ogdhcp/og-dhcp-subnets.component.ts @@ -91,15 +91,25 @@ export class OgDhcpSubnetsComponent implements OnInit { } syncSubnets() { - this.http.post(`${this.apiUrl}/sync`, {}) - .subscribe(response => { + this.loading = true; + const timeoutId = setTimeout(() => { + this.loading = false; + this.toastService.error('Error al sincronizar: tiempo de espera agotado'); + }, 3500); + + this.http.post(`${this.apiUrl}/sync`, {}).subscribe({ + next: (response) => { + clearTimeout(timeoutId); this.toastService.success('Sincronización con componente DHCP exitosa'); - this.loadSubnets() + this.loadSubnets(); this.loading = false; - }, error => { + }, + error: (error) => { + clearTimeout(timeoutId); this.loading = false; this.toastService.error('Error al sincronizar'); - }); + } + }); } toggleAction(subnet: any, action: string): void {