Hello guys here is my http post code
createPost(input:HTMLInputElement){
// input.value='';
let post={content:input.value};
let head = new Headers({ 'Content-Type': 'application/json' });
let requestOptions = new RequestOptions({headers: head});
let body = JSON.stringify(post);
this.http.post(this.url,body,requestOptions)
.subscribe(response => {
post['id']=response.json().id;
this.posts.splice(0,0,post);
});
after a successfull http post request my server responds with a token for authentication to make that request, the token would be in JSON format. Now is there any way where I can get that token in real time and store it in local storage directly after a http post call
I can understand the concept of localStorage.getItem() and all but don't know where to implement them exactly to the context of my code
this question might be so dumb to you but I'm just beginner in Angular