Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 142x 6x 6x 6x 6x 6x 6x 4x 2x 2x 2x 2x | import { Component, OnInit } from '@angular/core';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Router } from '@angular/router';
import { User } from '../../interfaces/user.interface';
import { SessionService } from '../../services/session.service';
import { UserService } from '../../services/user.service';
@Component({
selector: 'app-me',
templateUrl: './me.component.html',
styleUrls: ['./me.component.scss']
})
export class MeComponent implements OnInit {
public user: User | undefined;
constructor(private router: Router,
private sessionService: SessionService,
private matSnackBar: MatSnackBar,
private userService: UserService) {
}
public ngOnInit(): void {
this.userService
.getById(this.sessionService.sessionInformation!.id.toString())
.subscribe((user: User) => this.user = user);
}
public back(): void {
window.history.back();
}
public delete(): void {
this.userService
.delete(this.sessionService.sessionInformation!.id.toString())
.subscribe((_) => {
this.matSnackBar.open("Your account has been deleted !", 'Close', { duration: 3000 });
this.sessionService.logOut();
this.router.navigate(['/']);
})
}
}
|