From a8309988518af5bddf62d6a326d990fde4069b40 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 3 Jan 2016 19:41:31 +0100 Subject: Set focus properties to button elements --- src/client/elm/ServerCommunication.elm | 69 ---------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 src/client/elm/ServerCommunication.elm (limited to 'src/client/elm/ServerCommunication.elm') diff --git a/src/client/elm/ServerCommunication.elm b/src/client/elm/ServerCommunication.elm deleted file mode 100644 index 7c46d79..0000000 --- a/src/client/elm/ServerCommunication.elm +++ /dev/null @@ -1,69 +0,0 @@ -module ServerCommunication - ( sendRequest - , initViewAction - ) where - -import Signal -import Task as Task exposing (Task) -import Http -import Json.Decode as Json exposing ((:=)) -import Date -import Time exposing (Time) -import Debug - -import SimpleHTTP exposing (..) - -import Model.Communication exposing (..) -import Model.Action as U exposing (Action) -import Model.Action.LoggedInAction as UL -import Model.Action.MonthlyAction as UM -import Model.Action.AccountAction as UA -import Model.Payment exposing (..) -import Model.Payer exposing (Payers, payersDecoder) -import Model.User exposing (Users, usersDecoder, UserId, userIdDecoder) - -import Update.SignIn exposing (updateSignIn) - -sendRequest : Communication -> Task Http.Error U.Action -sendRequest communication = - case communication of - - SignIn assertion -> - post ("/signIn?assertion=" ++ assertion) - |> flip Task.andThen (always initViewAction) - - AddPayment name cost frequency -> - post (addPaymentURL name cost frequency) - |> flip Task.andThen (decodeHttpValue <| "id" := paymentIdDecoder) - |> Task.map (\paymentId -> (U.UpdateLoggedIn (UL.ValidateAddPayment paymentId name cost frequency))) - - DeletePayment payment frequency -> - post (deletePaymentURL payment.id) - |> Task.map (always (U.UpdateLoggedIn (UL.DeletePayment payment frequency))) - - SetIncome currentTime amount -> - post ("/income?amount=" ++ (toString amount)) - |> Task.map (always (U.UpdateLoggedIn (UL.UpdateAccount (UA.UpdateIncome currentTime amount)))) - - SignOut -> - post "/signOut" - |> Task.map (always U.GoSignInView) - -addPaymentURL : String -> Int -> PaymentFrequency -> String -addPaymentURL name cost frequency = - "/payment/add?name=" ++ name ++ "&cost=" ++ (toString cost) ++ "&frequency=" ++ (toString frequency) - -deletePaymentURL : PaymentId -> String -deletePaymentURL id = - "payment/delete?id=" ++ (toString id) - -initViewAction = Task.onError loggedInView (always <| Task.succeed U.GoSignInView) - -loggedInView : Task Http.Error Action -loggedInView = - Task.map U.GoLoggedInView (Http.get usersDecoder "/users") - `Task.andMap` (Http.get ("id" := userIdDecoder) "/whoAmI") - `Task.andMap` (Http.get paymentsDecoder "/monthlyPayments") - `Task.andMap` (Http.get paymentsDecoder "/payments") - `Task.andMap` (Http.get ("number" := Json.int) "/payments/count") - `Task.andMap` (Http.get payersDecoder "/payers") -- cgit v1.2.3