mirror of https://github.com/bastienwirtz/homer
Use promises for HTTP calls
parent
30d0265d39
commit
36d613c41f
|
@ -170,13 +170,15 @@ export default {
|
||||||
const authenticated = await this.authenticate();
|
const authenticated = await this.authenticate();
|
||||||
if (!authenticated) return;
|
if (!authenticated) return;
|
||||||
}
|
}
|
||||||
const summary_response = await this.fetch(
|
|
||||||
`api/stats/summary?sid=${encodeURIComponent(this.sessionId)}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
const status_response = await this.fetch(
|
const [summary_response, status_response] = await Promise.all([
|
||||||
`api/dns/blocking?sid=${encodeURIComponent(this.sessionId)}`,
|
this.fetch(
|
||||||
);
|
`api/stats/summary?sid=${encodeURIComponent(this.sessionId)}`
|
||||||
|
),
|
||||||
|
this.fetch(
|
||||||
|
`api/dns/blocking?sid=${encodeURIComponent(this.sessionId)}`
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
summary_response?.queries?.percent_blocked === undefined ||
|
summary_response?.queries?.percent_blocked === undefined ||
|
||||||
|
|
Loading…
Reference in New Issue