Small ZT refactor

This commit is contained in:
VakarisZ 2019-12-03 16:07:11 +02:00
parent 087b102984
commit ce0b15d801
1 changed files with 6 additions and 5 deletions

View File

@ -57,11 +57,13 @@ class ReportPageComponent extends AuthComponent {
attackReport: res attackReport: res
}); });
}); });
this.updateZeroTrustReportFromServer(); this.getZeroTrustReportFromServer().then((ztReport) => {
this.setState({zeroTrustReport: ztReport})
});
} }
} }
updateZeroTrustReportFromServer = async () => { getZeroTrustReportFromServer = async () => {
let ztReport = {findings: {}, principles: {}, pillars: {}}; let ztReport = {findings: {}, principles: {}, pillars: {}};
await this.authFetch('/api/report/zero_trust/findings') await this.authFetch('/api/report/zero_trust/findings')
.then(res => res.json()) .then(res => res.json())
@ -77,9 +79,8 @@ class ReportPageComponent extends AuthComponent {
.then(res => res.json()) .then(res => res.json())
.then(res => { .then(res => {
ztReport.pillars = res; ztReport.pillars = res;
}).then(() => { });
this.setState({zeroTrustReport: ztReport}) return ztReport
})
}; };
componentWillUnmount() { componentWillUnmount() {