Ionic Http headers API call


#1

Hi,

I have this method so far to make an authorised api call, I am struggling as it is not authrorising, any ideas as to what is missing?

getMethods(url:any) :Observable{
let headers = new Headers();
headers.append(‘Content-Type’, ‘application/json’);
headers.append(‘x-token’, localStorage.getItem(’’));

  return this.http.get(`${API_URL2+url}`,{headers:headers})
            .map((res:Response)=>{
                     return res.json();})
            .catch((error:any)=>Observable.throw(error)||'server error');
}