From c230392da8a30a7a6995bea0e9180e261fedd635 Mon Sep 17 00:00:00 2001 From: tanasegabriel Date: Sat, 17 May 2025 18:18:13 +0000 Subject: [PATCH] Use promises for HTTP calls --- src/components/services/PiHole.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/services/PiHole.vue b/src/components/services/PiHole.vue index aa702fd..d976184 100644 --- a/src/components/services/PiHole.vue +++ b/src/components/services/PiHole.vue @@ -162,13 +162,15 @@ export default { const authenticated = await this.authenticate(); if (!authenticated) return; } - const summary_response = await this.fetch( - `api/stats/summary?sid=${encodeURIComponent(this.sessionId)}`, - ); - const status_response = await this.fetch( - `api/dns/blocking?sid=${encodeURIComponent(this.sessionId)}`, - ); + const [summary_response, status_response] = await Promise.all([ + this.fetch( + `api/stats/summary?sid=${encodeURIComponent(this.sessionId)}` + ), + this.fetch( + `api/dns/blocking?sid=${encodeURIComponent(this.sessionId)}` + ) + ]); if ( summary_response?.queries?.percent_blocked === undefined ||