import { Component, OnInit } from '@angular/core'; import {ActivatedRoute} from "@angular/router"; import {PlayerServiceService} from "../../services/player-service.service"; import {PlayerProfile} from "../../entities/profile/PlayerProfile"; import {MatSnackBar} from "@angular/material/snack-bar"; @Component({ selector: 'app-profile-page', templateUrl: './profile-page.component.html', styleUrls: ['./profile-page.component.scss'] }) export class ProfilePageComponent implements OnInit { profile: PlayerProfile|null = null; constructor(private route: ActivatedRoute, private playerService: PlayerServiceService, private snack: MatSnackBar) { } ngOnInit(): void { const steam64: string|null = this.route.snapshot.queryParamMap.get("steam64"); this.loadPlayer(steam64); } loadPlayer(steam64: string|null) { this.playerService.getProfile(steam64, []).subscribe( (res) => this.profile = res, (err) => this.snack.open("Невозможно загрузить профиль") ); } }