Skip to content

Commit

Permalink
id is important
Browse files Browse the repository at this point in the history
  • Loading branch information
nkarmazina committed Sep 28, 2023
1 parent 8ce6b5b commit 1256468
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions frontend/src/app/report/report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export class ReportComponent implements OnInit {
reportId;

reportComponent;

/**
* Changed report
*/
updatedReports;
/**
* html report of the result
*/
Expand Down Expand Up @@ -112,10 +115,13 @@ export class ReportComponent implements OnInit {
}

ngAfterContentInit(){
window.addEventListener('storage', (event) => {
if (event.key === 'reportComponent') {
window.addEventListener('storage', (event) => {
if (event.key === 'reportComponent' ) {
const storedReportComponentString = localStorage.getItem('reportComponent');
this.reportComponent = JSON.parse(storedReportComponentString);
this.updatedReports = JSON.parse(storedReportComponentString);
if (this.updatedReports._id === this.reportComponent._id){
this.reportComponent = JSON.parse(storedReportComponentString);
}
}
});
}
Expand Down

0 comments on commit 1256468

Please sign in to comment.