2021-04-08 09:25:25 +01:00
|
|
|
function wlCommonInit() {
|
|
|
|
|
|
2021-06-23 09:19:09 +01:00
|
|
|
WLAuthorizationManager.obtainAccessToken("").then(
|
|
|
|
|
(token) => {
|
|
|
|
|
console.log('MobileFirst Server connect: Success ' + token);
|
2021-04-08 09:25:25 +01:00
|
|
|
|
2021-06-23 09:19:09 +01:00
|
|
|
var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/",
|
|
|
|
|
WLResourceRequest.GET
|
|
|
|
|
);
|
2021-04-08 09:25:25 +01:00
|
|
|
|
2021-06-23 09:19:09 +01:00
|
|
|
resourceRequest.setQueryParameter("name", "world");
|
|
|
|
|
resourceRequest.send().then(
|
|
|
|
|
(response) => {
|
|
|
|
|
// Will display "Hello world" in an alert dialog.
|
|
|
|
|
console.log("Connect with JavaAdapter Success: " + response.responseText);
|
|
|
|
|
//this.MFPushNotification();
|
|
|
|
|
},
|
|
|
|
|
(error) => {
|
|
|
|
|
alert("Connect with JavaAdapter Failure: " + JSON.stringify(error));
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}, (error) => {
|
|
|
|
|
console.log('MobileFirst Server connect: failure ' + error.responseText);
|
|
|
|
|
console.log(JSON.stringify(error))
|
|
|
|
|
/* this.zone.run(() => {
|
|
|
|
|
alert("Bummer...");
|
|
|
|
|
alert("Failed to connect to MobileFirst Server");
|
|
|
|
|
}); */
|
|
|
|
|
}
|
|
|
|
|
);
|
2021-04-08 09:25:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-06-23 09:19:09 +01:00
|
|
|
}
|