-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes-page.component.ts
More file actions
45 lines (40 loc) · 1.19 KB
/
Copy pathnotes-page.component.ts
File metadata and controls
45 lines (40 loc) · 1.19 KB
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
45
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { CommonModule } from '@angular/common';
import { AuthenticationService } from '../../services/authentication.service';
import { NotesFormComponent } from '../notes-form/notes-form.component';
import { NotesListComponent } from '../notes-list/notes-list.component';
import { ToastComponent } from '../toast/toast.component';
import { Notes } from '../../interfaces/notes';
@Component({
selector: 'app-notes-page',
standalone: true,
imports: [
CommonModule,
NotesFormComponent,
NotesListComponent,
ToastComponent,
],
templateUrl: './notes-page.component.html',
styleUrl: './notes-page.component.scss',
})
export class NotesPageComponent {
selectedNote!: Notes;
constructor(
private authService: AuthenticationService,
private router: Router,
) {}
get username(): string {
return this.authService.getCurrentUser()?.username || 'User';
}
onEditNote(note: Notes): void {
this.selectedNote = { ...note };
}
onFormSubmitted(): void {
this.selectedNote = null!;
}
onLogout(): void {
this.authService.logout();
this.router.navigate(['/login']);
}
}