From a40c4825996c90d107901b0d71162f9356f1395a Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sun, 19 Jul 2015 20:24:54 +0200 Subject: Showing login token error message in the UI --- src/client/Main.elm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/client/Main.elm') diff --git a/src/client/Main.elm b/src/client/Main.elm index e79fe2b..519360a 100644 --- a/src/client/Main.elm +++ b/src/client/Main.elm @@ -15,6 +15,7 @@ import Model exposing (Model, initialModel) import Model.Payment exposing (Payments, paymentsDecoder) import Update exposing (Action(..), actions, updateModel) +import Update.SignIn exposing (..) import View.Page exposing (renderPage) @@ -28,13 +29,21 @@ main = Signal.map renderPage model model : Signal Model model = Signal.foldp updateModel initialModel actions.signal +------------------------- + +port signInError : Maybe String + --------------------------------------- port fetchPayments : Task Http.Error () port fetchPayments = - getPayments - |> flip Task.andThen reportSuccess - |> flip Task.onError reportError + case signInError of + Just msg -> + Signal.send actions.address (SignInError msg) + Nothing -> + getPayments + |> flip Task.andThen reportSuccess + |> flip Task.onError reportError reportSuccess : Payments -> Task x () reportSuccess payments = Signal.send actions.address (UpdatePayments payments) -- cgit v1.2.3