Skip to content

Commit

Permalink
fix: restore deleted code
Browse files Browse the repository at this point in the history
  • Loading branch information
honzikec committed Aug 29, 2023
1 parent b20b4bb commit 74ed196
Showing 1 changed file with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, OnDestroy } from '@angular/core';
import { Store } from '@ngrx/store';
import { ActivatedRoute } from '@angular/router';
import { RepoContents, selectedRepository } from '../../state/repository';
import { map } from 'rxjs';
import { RepoContents, fetchRepository, selectedRepository } from '../../state/repository';
import { map, takeWhile, tap } from 'rxjs';

@Component({
selector: 'app-file-explorer',
Expand Down Expand Up @@ -32,7 +32,30 @@ export class FileExplorerComponent implements OnDestroy {
);
private componentActive = true;

constructor(private route: ActivatedRoute, private store: Store) {}
constructor(private route: ActivatedRoute, private store: Store) { }


ngOnInit() {
this.route.paramMap
.pipe(
takeWhile(() => this.componentActive),
tap((params) => {
this.owner = params.get('owner') as string;
this.repoName = params.get('repo') as string;
this.branch = params.get('branch') as string;
this.path = params.get('path') as string;
this.store.dispatch(
fetchRepository({
owner: this.owner,
repoName: this.repoName,
path: this.path,
branch: this.branch,
}),
);
}),
)
.subscribe();
}

ngOnDestroy(): void {
this.componentActive = false;
Expand Down

0 comments on commit 74ed196

Please sign in to comment.