- Removed MatToolbar and MatIcon imports from app.component.ts and updated app.component.html. - Reduced toast notification timeout from 3000ms to 1000ms in app.config.ts. - Changed default redirect path from 'auth' to 'chat' in app.routes.ts. - Added ToolbarComponent to AuthModule and ChatModule. - Updated login and register components to include the toolbar. - Simplified toast notifications in login and register components. - Implemented chat service to manage channels and messages. - Created message and profile picture components for chat feed. - Enhanced channel list component to handle selected channels. - Improved feed component to display messages based on selected channel.
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { Component } from '@angular/core';
|
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
import { MatIconModule } from '@angular/material/icon';
|
|
import { MatButtonModule } from '@angular/material/button';
|
|
import { AuthService } from '../../services/auth.service';
|
|
import { ToastrService } from 'ngx-toastr';
|
|
import { Router } from '@angular/router';
|
|
import { NgIf } from '@angular/common';
|
|
|
|
@Component({
|
|
selector: 'app-toolbar',
|
|
imports: [MatToolbarModule, MatIconModule, MatButtonModule, NgIf],
|
|
templateUrl: './toolbar.component.html',
|
|
styleUrl: './toolbar.component.scss'
|
|
})
|
|
export class ToolbarComponent {
|
|
constructor(
|
|
public authService: AuthService,
|
|
private toastrService: ToastrService,
|
|
private router: Router) { }
|
|
|
|
public Logout(): void {
|
|
this.authService.Logout()
|
|
.subscribe({
|
|
next: result => {
|
|
if (result) {
|
|
this.router.navigateByUrl('auth/login');
|
|
this.toastrService.info("Successfully logged out", "Logout");
|
|
} else {
|
|
this.toastrService.error("Logout failed", "Error");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|