aboutsummaryrefslogtreecommitdiff
path: root/src/client/Main.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/Main.elm')
-rw-r--r--src/client/Main.elm12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/Main.elm b/src/client/Main.elm
index e112144..bff5f23 100644
--- a/src/client/Main.elm
+++ b/src/client/Main.elm
@@ -27,10 +27,16 @@ model : Signal Model
model = Signal.foldp updateModel initialModel actions.signal
port fetchPayments : Task Http.Error ()
-port fetchPayments = getPayments `Task.andThen` report
+port fetchPayments =
+ getPayments
+ |> flip Task.andThen reportSuccess
+ |> flip Task.onError reportError
-report : Payments -> Task x ()
-report payments = Signal.send actions.address (UpdatePayments payments)
+reportSuccess : Payments -> Task x ()
+reportSuccess payments = Signal.send actions.address (UpdatePayments payments)
+
+reportError : Http.Error -> Task x ()
+reportError error = Signal.send actions.address Forbidden
getPayments : Task Http.Error Payments
getPayments = Http.get paymentsDecoder "/payments"