I am sending a GET request to backend rest service, as follows:
def showAllEmployees = Callback {
org.scalajs.dom.ext.Ajax.get(url = "http://localhost:8081/fetchAllEmployees").onComplete {
case Success(xhr) => {
Callback.log(xhr.responseText)
}
case Failure(t) => println("An error has occurred: " + t.getMessage)
}
}
I want to extract the records from the response. I observe that code inside case Success is not even executed.
So what is idiomatic way of doing it in scalajs-react?