Skip to content

Commit c230392

Browse files
tanasegabrielbastienwirtz
authored andcommitted
Use promises for HTTP calls
1 parent adf6717 commit c230392

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/components/services/PiHole.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,15 @@ export default {
162162
const authenticated = await this.authenticate();
163163
if (!authenticated) return;
164164
}
165-
const summary_response = await this.fetch(
166-
`api/stats/summary?sid=${encodeURIComponent(this.sessionId)}`,
167-
);
168165
169-
const status_response = await this.fetch(
170-
`api/dns/blocking?sid=${encodeURIComponent(this.sessionId)}`,
171-
);
166+
const [summary_response, status_response] = await Promise.all([
167+
this.fetch(
168+
`api/stats/summary?sid=${encodeURIComponent(this.sessionId)}`
169+
),
170+
this.fetch(
171+
`api/dns/blocking?sid=${encodeURIComponent(this.sessionId)}`
172+
)
173+
]);
172174
173175
if (
174176
summary_response?.queries?.percent_blocked === undefined ||

0 commit comments

Comments
 (0)