import { Injectable } from '@angular/core';
import { Router } from '@angular/router';

@Injectable({
  providedIn: 'root'
})
export class AuthService {

  constructor(private myRoute: Router) { }

  sendToken(token: string) {
    localStorage.setItem('LoggedInUser', token);
  }
  getToken() {
    return localStorage.getItem('userData');
  }
  isLoggednIn() {
    const router = this.myRoute.url;
    console.log(router);
    return this.getToken() !== null;
  }
  logout() {
    localStorage.removeItem('userData');
    this.myRoute.navigate(['/start/login']);
  }
}
