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.elm14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/client/Main.elm b/src/client/Main.elm
index bff5f23..e79fe2b 100644
--- a/src/client/Main.elm
+++ b/src/client/Main.elm
@@ -18,6 +18,8 @@ import Update exposing (Action(..), actions, updateModel)
import View.Page exposing (renderPage)
+import ServerCommunication exposing (serverCommunications, sendRequest)
+
{-| main -}
main : Signal Html
@@ -26,6 +28,8 @@ main = Signal.map renderPage model
model : Signal Model
model = Signal.foldp updateModel initialModel actions.signal
+---------------------------------------
+
port fetchPayments : Task Http.Error ()
port fetchPayments =
getPayments
@@ -36,7 +40,15 @@ reportSuccess : Payments -> Task x ()
reportSuccess payments = Signal.send actions.address (UpdatePayments payments)
reportError : Http.Error -> Task x ()
-reportError error = Signal.send actions.address Forbidden
+reportError error = Signal.send actions.address SignIn
getPayments : Task Http.Error Payments
getPayments = Http.get paymentsDecoder "/payments"
+
+---------------------------------------------------
+
+port serverCommunicationsPort : Signal (Task Http.RawError ())
+port serverCommunicationsPort =
+ Signal.map
+ (\comm -> sendRequest comm `Task.andThen` (Signal.send actions.address))
+ serverCommunications.signal