I have a service in Angular 6 and I'm trying to change a record but it's saying I'm not authorized.
Right now I have this:
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
update(id, title, content) {
const updateData = { id: id, title: title, content: content };
return this.http.put(`http://myurl/${id}`, updateData, httpOptions);
}
My question is:
How to I add basic authorization to my httpOptions or do I add it direct to the update method?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…