From a6727f104f808e533052f2bd83bc89cd6bfa0522 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Sun, 19 Jul 2015 00:45:42 +0200 Subject: Adding UI to sign in and sign out --- src/client/Main.elm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/client/Main.elm') 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 -- cgit v1.2.3