javascript - POST requests are being called twice in angular 2 -


i don't know post requests being called twice. may know fix this? tried using share() no avail.

the following code

 adduser(data): observable<user> {       let body : string = json.stringify(     {postdata: data}),     headers: = new headers({'content-type': 'application/json'}),     options: = new requestoptions({ headers: headers}),     url: = this.url+"/user/register";       return this.http.post(url,body,options).map(res=> <any>(res['_body']));   } 

enter image description here

first request type options, it's normal. http options method used describe communication options target resource.

read more here: https://developer.mozilla.org/en-us/docs/web/http/access_control_cors


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -