Arguments
response: The standard Erswhile response coming back from an API call to an Ersthwhile-compatible backend.
Effect
Erstwhile-compatible backends return an JSON object in this format for Create, Update or Delete types of operations:
{
"success": , // indicates whether or not the operation was successful
"authenticated": , // indicates whether or not user has a valid session
"message": , // optional. Indicates a message to display to the user, either positive or negative.
"errors": [], // optional. In the case of errors, they may be presented as an array of strings.
"errorsObj": <object> // optional. Errors mapped to form properties, if needed.
}
This method takes in this type of response and updates all of the components to show their error states (or not) depending on this structure.