Remote


What is it?

Navigation for remote content.

The structure is represented by the attributes below:

AttributeTypeRequiredDefinition
urlString or BindingNavigation address.
shouldPrefetchBooleanLoad the address previously.
fallbackScreenScreen to be returned in case the loading fails.
httpAdditionalDataHttpAdditionalDataCan be used on navigation actions to pass additional http data for the requests made to the backend.

The HttpAdditionalData object has the method, headers and body attributes.

AttributeTypeRequiredDefinition
methodHTTPMethodThe http method to perform the request: get, put, post, delete, etc
headersMap<String, String>Header items for the request.
bodyAnyContent to be sent in the body of the request. Can be either a string or an object that can be serialized to a JSON string

How to use it?

Button(
    onPress = listOf(
      Navigate.PushView(
        route = Route.Remote(
          url = "/present/view",
          httpAdditionalData = HttpAdditionalData(
            method = HttpMethod.POST,
            headers = mapOf("test" to "test"),
            body = mapOf("framework" to "Beagle")
          )
        )
      )
    ),
    text = "Click me!"
)