Browse Source

- Protected a few calls till we are authenticated

pull/1/head
Dan 1 year ago
parent
commit
00fcf80462
  1. 8
      src/app/app.component.ts
  2. 3
      src/app/features/plan/plan-pokemon/plan-pokemonV2.component.ts
  3. 14
      src/app/features/plan/planV2.component.ts

8
src/app/app.component.ts

@ -144,9 +144,15 @@ export class AppComponent {
constructor(
public auth: AuthService,
public pokemonService: PokemonService,
private authService: AuthService,
private router: Router
) {
this.pokemonService.initializeCaughtPokemon();
this.authService.isAuthenticated$.subscribe((isAuthenticated) => {
if (isAuthenticated) {
this.pokemonService.initializeCaughtPokemon();
console.log("Loading Plan")
}
});
}
isRouteSelected(route: string): boolean {

3
src/app/features/plan/plan-pokemon/plan-pokemonV2.component.ts

@ -178,8 +178,8 @@ export class PlanPokemonV2Component {
ngOnInit() {
this.representative_pokemon = null;
this.handlePokemonFamilyChange(this.pokemon_family);
this.catch_count = this.pokemon_family.catch_count;
this.handlePokemonFamilyChange(this.pokemon_family);
}
ngOnChanges(changes: SimpleChanges) {
@ -213,7 +213,6 @@ export class PlanPokemonV2Component {
});
this.updateCatchCount();
this.cdr.markForCheck();
}
get hasTargets(): boolean {

14
src/app/features/plan/planV2.component.ts

@ -8,6 +8,7 @@ import { GamePlan, PokemonFamilyEntry } from '../../core/models/plan.model';
import { PlanPokemonV2Component } from "./plan-pokemon/plan-pokemonV2.component";
import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { PlanPokemonDetailsComponent } from "./plan-pokemon-details/plan-pokemon-details.component";
import { AuthService } from '../../core/services/auth.service';
@Component({
selector: 'app-planV2',
@ -147,10 +148,19 @@ export class PlanV2Component implements OnInit {
selectedGame: GamePlan | null = null;
selectedPokemon: PokemonFamilyEntry | null = null;
constructor(private planService: PlanService, private cdr: ChangeDetectorRef) {}
constructor(
private planService: PlanService,
private cdr: ChangeDetectorRef,
private authService: AuthService
) {}
ngOnInit() {
this.loadPlan();
this.authService.isAuthenticated$.subscribe((isAuthenticated) => {
if (isAuthenticated) {
this.loadPlan();
console.log("Loading Plan")
}
});
}
private loadPlan() {

Loading…
Cancel
Save