1
0
Fork 0
mirror of https://github.com/bastienwirtz/homer.git synced 2026-01-23 02:15:09 +00:00

Use promises for HTTP calls

This commit is contained in:
tanasegabriel 2025-05-17 18:18:13 +00:00 committed by Bastien Wirtz
parent adf671772b
commit c230392da8

View file

@ -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 ||