aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris2015-12-30 01:29:11 +0100
committerJoris2015-12-30 01:29:11 +0100
commit73a2f72f07ca2a8c8757bcfd9e8ff37561dcb332 (patch)
treefb2445b0d6c0ad6be26493309c2a87f38b5c5e70
parentae3fd8922969f37292007c6e9f9cb5b1a11e4acd (diff)
Call persona sign out if there is an error in the sign-in call
-rw-r--r--src/client/elm/ServerCommunication.elm6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/client/elm/ServerCommunication.elm b/src/client/elm/ServerCommunication.elm
index 70612cb..3ecfc3b 100644
--- a/src/client/elm/ServerCommunication.elm
+++ b/src/client/elm/ServerCommunication.elm
@@ -14,6 +14,8 @@ import Debug
import SimpleHTTP exposing (..)
+import Persona exposing (operations)
+
import Model.User exposing (UserId)
import Model.Payment exposing (..)
import Model.View.LoggedIn.Add exposing (Frequency(..))
@@ -50,6 +52,10 @@ sendRequest communication =
SignIn assertion ->
post ("/signIn?assertion=" ++ assertion)
|> flip Task.andThen (always initViewAction)
+ |> flip Task.onError (\err ->
+ Signal.send operations.address Persona.SignOut
+ |> flip Task.andThen (always <| Task.fail err)
+ )
AddPayment userId name cost ->
post (addPaymentURL name cost Punctual)