Generic outcome confirmation pattern

Most actions the user performs are initiated via a user interface on the front end. The front end then communicates some amount of data to the back end, where the back end performs some logic on that data and persists any changes in the database. The back end should also generate some sort of a response to the front end (and ultimately the user) to inform them of the outcome of their attempted actions. This response often consists of two parts:

  1. Navigation to a particular page based on outcome

  2. Toast showing the explicit outcome (and in the case of a failure, the option to try again)

More rarely, a response may contain a third part - something to the effect of would you like to repeat this action again? For example, when adding a crop to a field it is very likely a farmer will add many crops in a row. In this case, a templated next step that remembers the field is intuitive and saves the farmer time.

The following is a generic pattern for handling this very common pattern:

https://app.lucidchart.com/invitations/accept/1f38e14c-d223-4ae4-82c2-2b4635c12221

Use Cases:

Use Case

FE

BE

Responses

Use Case

FE

BE

Responses

Invite a new user to my farm

Enter name, email, role, wage, etc. and click “Invite”

  • Check if user exists

  • If no user, create one

  • Link user to farm

  • Generate invitation email

  • Success: Toast showing “User invited!”; navigate to “View all users” page

  • Failure: Toast showing “Something went wrong! Try again?”; user remains on “Invite new user” page

Add a new crop to my field

Enter type of crop, variety, percentage of field, price per lb, estimated yield, etc. and click “Save”

  • Create instance of crop

  • Link to field

  • Calculate estimated production and revenue

  • Success: “Almonds added to Wonderwood Field! Planting another crop?”; navigate to Wonderwood field

  • Failure: “There was an issue saving your new crop! Try again?”; stay on crop creation page