---
# System prepended metadata

title: Untitled

---

```typescript=
...

import { Actions, ofActionCompleted, Select, Store } from '@ngxs/store';
...

@Component({
  selector: 'doa-root',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.scss' ],
  animations: [
    fadeInOnEnterAnimation()
  ]
})
export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
  ...

  constructor(...
              private actions: Actions,
              ...) {
  }

  ngAfterViewInit(): void {
    this.logger.debug('AppComponent.ngAfterViewInit():');

    this.actions
      .pipe(
        ofActionCompleted(GetAllClassDefinitions),
        tap(() =>
          this.documentClassNamesList$
            .pipe(take(1))
            .subscribe((namesList: string[]) =>
              this.store.dispatch(new GetAllTemplates(namesList)))
        ),
        tap(() =>
          this.mergedPropertyDefinitions$
            .pipe(take(1))
            .subscribe((propertyDefinitions: PropertyDefinitions) =>
              this.store.dispatch(new SetDmsPropertyDefinitions(propertyDefinitions)))
        )
      ).subscribe();
    this.actions
      .pipe(
        ofActionCompleted(SetDmsDossierPath, SetDmsFieldQueries, SetDmsQueryString, SetDmsAggregations, SetUploadFinished, DeleteDocument),
        delay(500),
        tap(() => this.store.dispatch(new FetchDocuments()))
      ).subscribe();
    this.actions
      .pipe(
        ofActionCompleted(SetPropertyId, SelectLocale),
        delay(100),
        tap(() =>
          this.dmsQuery$
            .pipe(take(1))
            .subscribe((dmsQuery: DmsQuery) =>
              this.store.dispatch([
                new FetchTree(dmsQuery.propertyId),
                new UpdateTreeDocumentCount(dmsQuery)
              ])
            )
        )
      ).subscribe();
  }

  ngOnDestroy(): void {
    this.logger.debug('AppComponent.ngOnDestroy():');
  }

  get version() {
    return environment.version;
  }

  get production() {
    return environment.production;
  }

  closeModal() {
    this.openModal = null;
  }
}


```