Skip to content

Instantly share code, notes, and snippets.


jeaye/flow.cljs Secret

Last active November 5, 2017 02:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
(def boot-flow
{:id ::boot
:first-dispatch []
; Credentials can be loaded or acquired from showing a login.
:rules [{:when :seen-any-of?
:events []
; If there are no saved credentials, we have to show a login.
:dispatch []}
{:when :seen-any-of?
:events []
; Once we have credentials, touch the server.
:dispatch-n [[] ; Success doesn't matter.
; TODO: Unfortunately, do-touch may give an HTTP 403. This can happen
; if the loaded credentials were expired on invalid. In this case, I
; want the flow to jump back to the first rule.
{:when :seen?
:dispatch [::success-boot]
:halt? true}
{:when :seen-any-of?
:events []
:dispatch [::fail-boot]
:halt? true}]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment