aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Main.elm15
-rw-r--r--src/client/Update.elm4
2 files changed, 16 insertions, 3 deletions
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)
diff --git a/src/client/Update.elm b/src/client/Update.elm
index 1d0fe95..508ee2f 100644
--- a/src/client/Update.elm
+++ b/src/client/Update.elm
@@ -14,6 +14,7 @@ import Update.SignIn exposing (..)
type Action =
NoOp
| SignIn
+ | SignInError String
| UpdateSignIn SignInAction
| UpdatePayments Payments
@@ -27,6 +28,9 @@ updateModel action model =
model
SignIn ->
{ model | view <- SignInView initSignIn }
+ SignInError msg ->
+ let signIn = { initSignIn | result <- Just (Err msg) }
+ in { model | view <- SignInView signIn }
UpdateSignIn signInAction ->
case model.view of
SignInView signIn ->