diff options
author | Joris Guyonvarch | 2015-07-19 00:45:42 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-07-19 00:45:42 +0200 |
commit | a6727f104f808e533052f2bd83bc89cd6bfa0522 (patch) | |
tree | 2c7b8b16d377c04e9e9a32b74102666f6dae16cf /src/client/Main.elm | |
parent | 3486644b442a0800f645ec9ae7f3ce8fe2b3c9cd (diff) |
Adding UI to sign in and sign out
Diffstat (limited to 'src/client/Main.elm')
-rw-r--r-- | src/client/Main.elm | 14 |
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 |