From 73a2f72f07ca2a8c8757bcfd9e8ff37561dcb332 Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 30 Dec 2015 01:29:11 +0100 Subject: Call persona sign out if there is an error in the sign-in call --- src/client/elm/ServerCommunication.elm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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) -- cgit v1.2.3