import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { CommonModule } from '@angular/common';
import { Authentication } from '../../../services/Authentication';

@Component({
  selector: 'account-logout',
  templateUrl: './logout.component.html',
  imports: [ FormsModule, CommonModule ],
  standalone: true
})
export class LogoutComponent {
  errorMsgs: string[] = [];
  returnURL: string = '/';

  constructor( private http: HttpClient, private router: Router, private route: ActivatedRoute, private title: Title, public auth: Authentication ) {
    this.title.setTitle("Logout | Mistox");
  }

  ngAfterViewInit(){
    this.auth.Logout().subscribe({
        next: data => {
          window.location.href = "";
        }
    });
  }
}