import { Injectable } from '@angular/core' ; import { User } from '../../../graphql' ; @ Injectable ( ) export class LoginService { constructor ( ) { } storeAuthHeader ( auth ) { localStorage . setItem ( 'Authorization' , auth ) ; } getAuthHeader ( ) { return localStorage . getItem ( 'Authorization' ) ; } removeAuthHeader ( ) { localStorage . removeItem ( 'Authorization' ) ; } storeUser ( user ) { localStorage . setItem ( 'user' , JSON . stringify ( user ) ) ; } getUser ( ) { return JSON . parse ( localStorage . getItem ( 'user' ) ) ; } removeUser ( ) { localStorage . removeItem ( 'user' ) ; } createBase64Auth ( username , password ) { return `Basic ${ btoa ( `${ username }:${ password }` ) }` ; } }