diff options
author | Joris | 2017-03-24 09:21:06 +0000 |
---|---|---|
committer | Joris | 2017-03-24 09:21:06 +0000 |
commit | c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456 (patch) | |
tree | 8a438430cee7411259fc395d8f3898488e85d750 /src/client/elm/Model/User.elm | |
parent | 293eb8295162bf0a038f488237db9c9d1316c04d (diff) | |
parent | cfca18262c1ff48dcb683ddab7d03cf8e55573ff (diff) | |
download | budget-c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456.tar.gz budget-c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456.tar.bz2 budget-c0ac16a713c4e53cf6af8e72a6d5f6b8ac5d6456.zip |
Merge branch 'features/categories' into 'master'
Features/categories
See merge request !1
Diffstat (limited to 'src/client/elm/Model/User.elm')
-rw-r--r-- | src/client/elm/Model/User.elm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/client/elm/Model/User.elm b/src/client/elm/Model/User.elm index 02f2cea..f6e8147 100644 --- a/src/client/elm/Model/User.elm +++ b/src/client/elm/Model/User.elm @@ -8,7 +8,7 @@ module Model.User exposing , getUserName ) -import Json.Decode as Json exposing ((:=)) +import Json.Decode as Decode exposing (Decoder) import Dict exposing (Dict) type alias Users = Dict UserId User @@ -20,23 +20,23 @@ type alias User = , email : String } -usersDecoder : Json.Decoder Users -usersDecoder = Json.map Dict.fromList (Json.list userWithIdDecoder) +usersDecoder : Decoder Users +usersDecoder = Decode.map Dict.fromList (Decode.list userWithIdDecoder) -userWithIdDecoder : Json.Decoder (UserId, User) +userWithIdDecoder : Decode.Decoder (UserId, User) userWithIdDecoder = - Json.object2 (,) - ("id" := userIdDecoder) + Decode.map2 (,) + (Decode.field "id" userIdDecoder) userDecoder -userIdDecoder : Json.Decoder UserId -userIdDecoder = Json.int +userIdDecoder : Decoder UserId +userIdDecoder = Decode.int -userDecoder : Json.Decoder User +userDecoder : Decoder User userDecoder = - Json.object2 User - ("name" := Json.string) - ("email" := Json.string) + Decode.map2 User + (Decode.field "name" Decode.string) + (Decode.field "email" Decode.string) getUserName : Users -> UserId -> Maybe String getUserName users userId = |