Skip to content

Instantly share code, notes, and snippets.

@LucianU
Created January 17, 2019 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LucianU/310bff3681f260d80e3e6037c7394831 to your computer and use it in GitHub Desktop.
Save LucianU/310bff3681f260d80e3e6037c7394831 to your computer and use it in GitHub Desktop.
approveOtp ::
Session ->
Session
approveOtp (Session session) = let approveOtpV = execState (do
modify_ ((\{ approved } ->
{ approved: "F"
}))
if Array.any (\(Event e) ->
String.toLower (fromMaybe "null" e.label) == "approve_otp") session.events
then modify_ ((\{ approved } ->
{ approved: "T"
}))
else modify_ ((\st ->
st))
modify_ ((\{ approveOtp } ->
{ approveOtp: Just approved
}))) { foo: Nothing
}
in Session $ session { approveOtp = approveOtpV
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment