aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorJoris2015-09-11 10:36:27 +0200
committerJoris2015-09-11 10:36:27 +0200
commitd87dbd1360c14df83552fd757438c23e5d7b9f9c (patch)
tree8b28def0414205608bd964c9b38a98b9d6828655 /src/client
parent73fa92aeffb27a98d8f316be157883ecefb1aed5 (diff)
downloadbudget-d87dbd1360c14df83552fd757438c23e5d7b9f9c.tar.gz
budget-d87dbd1360c14df83552fd757438c23e5d7b9f9c.tar.bz2
budget-d87dbd1360c14df83552fd757438c23e5d7b9f9c.zip
Using jsonObject to create on the fly json object responses
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Main.elm1
-rw-r--r--src/client/Model/Message.elm8
-rw-r--r--src/client/ServerCommunication.elm19
3 files changed, 9 insertions, 19 deletions
diff --git a/src/client/Main.elm b/src/client/Main.elm
index e59692a..0b579d7 100644
--- a/src/client/Main.elm
+++ b/src/client/Main.elm
@@ -15,7 +15,6 @@ import Model exposing (Model, initialModel)
import Model.User exposing (Users, usersDecoder, UserId, userIdDecoder)
import Model.Payment exposing (Payments, paymentsDecoder, perPage)
import Model.Payers exposing (Payers, payersDecoder)
-import Model.Message exposing (messageDecoder)
import Model.Translations exposing (..)
import Update exposing (Action(..), actions, updateModel)
diff --git a/src/client/Model/Message.elm b/src/client/Model/Message.elm
deleted file mode 100644
index 9f21fd3..0000000
--- a/src/client/Model/Message.elm
+++ /dev/null
@@ -1,8 +0,0 @@
-module Model.Message
- ( messageDecoder
- ) where
-
-import Json.Decode exposing (..)
-
-messageDecoder : Decoder String
-messageDecoder = ("message" := string)
diff --git a/src/client/ServerCommunication.elm b/src/client/ServerCommunication.elm
index fefbbff..5736f77 100644
--- a/src/client/ServerCommunication.elm
+++ b/src/client/ServerCommunication.elm
@@ -10,7 +10,6 @@ import Http
import Json.Decode exposing (..)
import Date
-import Model.Message exposing (messageDecoder)
import Model.User exposing (UserId)
import Model.Payment exposing (..)
import Model.View.LoggedIn.Add exposing (Frequency(..))
@@ -108,16 +107,16 @@ serverResult communication response =
SignOut ->
Task.succeed (U.GoSignInView)
errorStatus ->
- decodeResponse
- messageDecoder
- (\error ->
- case communication of
- SignIn _ ->
+ case communication of
+ SignIn _ ->
+ decodeResponse
+ ("error" := string)
+ (\error ->
Task.succeed <| U.UpdateSignIn (ErrorLogin error)
- _ ->
- Task.succeed <| U.NoOp
- )
- response
+ )
+ response
+ _ ->
+ Task.succeed <| U.NoOp
decodeOkResponse : Decoder a -> (a -> Task b U.Action) -> Http.Response -> Task b U.Action
decodeOkResponse decoder responseToAction response =