@@ -3,7 +3,7 @@ import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output}
33import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' ;
44import { LocalStorageService } from 'ngx-webstorage' ;
55import { EMPTY , Observable } from 'rxjs' ;
6- import { catchError , concatMap , filter , map } from 'rxjs/operators' ;
6+ import { catchError , concatMap , filter , map , tap } from 'rxjs/operators' ;
77import { UtmToastService } from '../../../../shared/alert/utm-toast.service' ;
88import { CpStandardService } from '../../services/cp-standard.service' ;
99import { ComplianceStandardType } from '../../type/compliance-standard.type' ;
@@ -33,13 +33,15 @@ export class UtmCpStandardComponent implements OnInit {
3333 . pipe ( filter ( refresh => ! ! refresh ) ,
3434 concatMap ( ( ) => this . standardService . fetchData ( { page : 0 , size : 1000 } ) ) ,
3535 map ( ( res ) => res . body ) ,
36+ tap ( standards => {
37+ this . selectedStandard = standards . find ( s => s . id == this . standardId ) ;
38+ } ) ,
3639 catchError ( ( err : HttpErrorResponse ) => {
3740 this . toastService . showError ( 'Error' ,
3841 'Unable to retrieve the list of compliance standards. Please try again or contact support.' ) ;
3942 return EMPTY ;
4043 } ) ) ;
4144
42- this . selectedStandard = this . $localStorage . retrieve ( 'selectedStandard' ) ;
4345 this . standardService . notifyRefresh ( true ) ;
4446 }
4547
@@ -54,7 +56,6 @@ export class UtmCpStandardComponent implements OnInit {
5456 }
5557
5658 confirmSelection ( ) {
57- this . $localStorage . store ( 'selectedStandard' , this . selectedStandard ) ;
5859 this . activeModal . close ( this . selectedStandard ) ;
5960 }
6061}
0 commit comments