Skip to content
Snippets Groups Projects
Commit 5e7e46c7 authored by pnogal's avatar pnogal Committed by Paulina Nogal
Browse files

Move subscription to onInit

parent 4b5bded5
No related branches found
No related tags found
No related merge requests found
...@@ -87,6 +87,12 @@ export class DegreePlannerComponent implements OnInit, OnDestroy { ...@@ -87,6 +87,12 @@ export class DegreePlannerComponent implements OnInit, OnDestroy {
map(years => Object.keys(years)), map(years => Object.keys(years)),
distinctUntilChanged(utils.compareStringArrays), distinctUntilChanged(utils.compareStringArrays),
); );
this.activeTermSubscription = this.store
.pipe(select(selectors.getActiveTerms))
.subscribe(terms => {
this.firstActiveTerm = terms[0];
});
} }
// Unsubscribe from subs to prevent memeory leaks // Unsubscribe from subs to prevent memeory leaks
...@@ -148,12 +154,6 @@ export class DegreePlannerComponent implements OnInit, OnDestroy { ...@@ -148,12 +154,6 @@ export class DegreePlannerComponent implements OnInit, OnDestroy {
} }
public onMakePrimayClick(currentPlan: DegreePlan) { public onMakePrimayClick(currentPlan: DegreePlan) {
this.activeTermSubscription = this.store
.pipe(select(selectors.getActiveTerms))
.subscribe(terms => {
this.firstActiveTerm = terms[0];
});
const currentTerm: any = new GetTermDescriptionPipe().transform( const currentTerm: any = new GetTermDescriptionPipe().transform(
this.firstActiveTerm, this.firstActiveTerm,
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment