aboutsummaryrefslogtreecommitdiff
path: root/src/client/ServerCommunication.elm
diff options
context:
space:
mode:
authorJoris2015-09-11 10:36:27 +0200
committerJoris2015-09-11 10:36:27 +0200
commitd87dbd1360c14df83552fd757438c23e5d7b9f9c (patch)
tree8b28def0414205608bd964c9b38a98b9d6828655 /src/client/ServerCommunication.elm
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/ServerCommunication.elm')
-rw-r--r--src/client/ServerCommunication.elm19
1 files changed, 9 insertions, 10 deletions
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 =