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() {