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

@Injectable({ providedIn: 'root' })
export class JwtService {
  getToken(): String | null {
    return window.localStorage.getItem('EpIsToken');
  }

  saveToken(token: string | undefined | null) {
    window.localStorage.setItem('EpIsToken', token ?? '');
  }

  saveAccessToken(token: string | undefined | null) {
    window.localStorage.setItem('access_token', token ?? '');
  }

  getAccessToken(): string | null {
    return window.localStorage.getItem('access_token');
  }

  destroyToken() {
    window.localStorage.removeItem('EpIsToken');
    window.localStorage.removeItem('access_token');
  }
}
