WiContributionUtils.getAppConfig(this.http)
.subscribe(data => {
if (data.deployment === APP_DEPLOYMENT.ON_PREMISE) {
console.log("This is FE env")
}else {
console.log("This is TCI env")
}
});
Send request from our backend to avoid the site cors issue. You can also refer to design time SDK WiProxyCORSUtils
of app/contrib/wi-contrib.d.ts/
It does support most cases of HTTP request, you can specify method and adding query parameter or headers.
Example:
WiProxyCORSUtils.createRequest(http, url).addMethod("GET")
.addHeader("Authorization", "Bearer " + connCredential["access_token"])
.send()
.subscribe((response: Response) => {
if (response.status === 200) {
// 200 body
} else {
// not 200, maybe erro etc
}
}, errRsp => {
if (errRsp.status == 401) {
// error handler
} else {
console.log("Unkown error for request: " + errRsp);
}
})