-
-
Save caponetto/9e4be8dfadc593e604d1fd468494a75f to your computer and use it in GitHub Desktop.
Backend sample service: Calling and handling the service response in the editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SampleServiceWrapper.get().hello("Guilherme", 5000).then((CapabilityResponse<String> response) -> { | |
// Sample - capability not available can be handled like this. | |
if (CapabilityResponseStatus.withName(response.getStatus()) == CapabilityResponseStatus.NOT_AVAILABLE) { | |
DomGlobal.console.info(response.getMessage()); | |
} | |
// Sample - response completed can be handled like this. | |
if (CapabilityResponseStatus.withName(response.getStatus()) == CapabilityResponseStatus.OK) { | |
DomGlobal.console.info(response.getBody()); | |
} | |
return null; | |
}).catch_(error -> { | |
DomGlobal.console.error("Error caught: " + error); | |
return null; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment