pages + refactor
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
|
||||
import { UserService } from '../../services/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'page-user',
|
||||
templateUrl: './user.page.html',
|
||||
styleUrls: [ './user.page.scss' ]
|
||||
})
|
||||
export class PageUser implements OnInit {
|
||||
|
||||
notfound: boolean = false;
|
||||
username: string;
|
||||
user: any;
|
||||
|
||||
constructor(private userService: UserService,
|
||||
private route: ActivatedRoute) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.username = this.route.snapshot.paramMap.get('username');
|
||||
this.userService.getUser(this.username).subscribe((data) => {
|
||||
this.user = data;
|
||||
}, (error) => {
|
||||
if (error.status == 404) {
|
||||
this.notfound = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user