I'm trying to make this post call when user closes the window.
createCallRecord (data) {
let logData = {"chathist" : data , "uid": "1111" };
let headers = new HttpHeaders();
headers = headers.set("Content-Type", "application/json");
let options = { headers: headers };
return this.http.post(MY_URL, logData, options).subscribe(res => alert(res));
}
Since this is called when the user closes the window, i don't know whether it's posting sucessfully or not.
How to handle success or error after posting?
For now, it is not alerting anything.
Any help would be appreciated!