From ce0b15d801df3a24f347b92ffbb3940856e9f3b2 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 3 Dec 2019 16:07:11 +0200 Subject: [PATCH] Small ZT refactor --- .../cc/ui/src/components/pages/ReportPage.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js index d46f49d5a..451b69213 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ReportPage.js @@ -57,11 +57,13 @@ class ReportPageComponent extends AuthComponent { attackReport: res }); }); - this.updateZeroTrustReportFromServer(); + this.getZeroTrustReportFromServer().then((ztReport) => { + this.setState({zeroTrustReport: ztReport}) + }); } } - updateZeroTrustReportFromServer = async () => { + getZeroTrustReportFromServer = async () => { let ztReport = {findings: {}, principles: {}, pillars: {}}; await this.authFetch('/api/report/zero_trust/findings') .then(res => res.json()) @@ -77,9 +79,8 @@ class ReportPageComponent extends AuthComponent { .then(res => res.json()) .then(res => { ztReport.pillars = res; - }).then(() => { - this.setState({zeroTrustReport: ztReport}) - }) + }); + return ztReport }; componentWillUnmount() {