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'])); }
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
Post a Comment