myFunction() {
this.initiateTSOAddressSpace().then(this.launchApp);
return "placeholder text";
}
sendData(contentURL: string) {
let response = fetch(contentURL, {
method: "POST",
credentials: "include",
headers: {"Accept": "application/json"}
})
.then(res => res.json())
.catch((error) => {
console.log("An error occurred: " + error);
});
return response;
}
getKeyForServlet(result: any) {
return result.servletKey;
}
launchApp(result: any) {
console.log(this.getKeyForServlet(result));
let url = `${this.BASE_URL}/tsoAp/app/${this.getKeyForServlet(result)}`;
console.log(url);
return this.sendData(url);
}
Whenever I execute the above code, it throws an ERROR Error: "Uncaught (in promise): TypeError: this is undefined. This issue arises during the execution of ".then(this.launchApp)"