You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
1.0 KiB

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("Невозможно загрузить профиль")
);
}
}