Skip to content

Commit 74ed196

Browse files
committed
fix: restore deleted code
1 parent b20b4bb commit 74ed196

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

angular-ngrx-scss/src/app/file-viewer/file-explorer/file-explorer.component.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component, OnDestroy } from '@angular/core';
22
import { Store } from '@ngrx/store';
33
import { ActivatedRoute } from '@angular/router';
4-
import { RepoContents, selectedRepository } from '../../state/repository';
5-
import { map } from 'rxjs';
4+
import { RepoContents, fetchRepository, selectedRepository } from '../../state/repository';
5+
import { map, takeWhile, tap } from 'rxjs';
66

77
@Component({
88
selector: 'app-file-explorer',
@@ -32,7 +32,30 @@ export class FileExplorerComponent implements OnDestroy {
3232
);
3333
private componentActive = true;
3434

35-
constructor(private route: ActivatedRoute, private store: Store) {}
35+
constructor(private route: ActivatedRoute, private store: Store) { }
36+
37+
38+
ngOnInit() {
39+
this.route.paramMap
40+
.pipe(
41+
takeWhile(() => this.componentActive),
42+
tap((params) => {
43+
this.owner = params.get('owner') as string;
44+
this.repoName = params.get('repo') as string;
45+
this.branch = params.get('branch') as string;
46+
this.path = params.get('path') as string;
47+
this.store.dispatch(
48+
fetchRepository({
49+
owner: this.owner,
50+
repoName: this.repoName,
51+
path: this.path,
52+
branch: this.branch,
53+
}),
54+
);
55+
}),
56+
)
57+
.subscribe();
58+
}
3659

3760
ngOnDestroy(): void {
3861
this.componentActive = false;

0 commit comments

Comments
 (0)