aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model/Init.elm
diff options
context:
space:
mode:
authorJoris2017-03-24 09:21:04 +0000
committerJoris2017-03-24 09:21:04 +0000
commitcfca18262c1ff48dcb683ddab7d03cf8e55573ff (patch)
tree8a438430cee7411259fc395d8f3898488e85d750 /src/client/elm/Model/Init.elm
parent293eb8295162bf0a038f488237db9c9d1316c04d (diff)
downloadbudget-cfca18262c1ff48dcb683ddab7d03cf8e55573ff.tar.gz
budget-cfca18262c1ff48dcb683ddab7d03cf8e55573ff.tar.bz2
budget-cfca18262c1ff48dcb683ddab7d03cf8e55573ff.zip
Features/categories
Diffstat (limited to 'src/client/elm/Model/Init.elm')
-rw-r--r--src/client/elm/Model/Init.elm22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/client/elm/Model/Init.elm b/src/client/elm/Model/Init.elm
index 3a86dba..db7069f 100644
--- a/src/client/elm/Model/Init.elm
+++ b/src/client/elm/Model/Init.elm
@@ -3,23 +3,29 @@ module Model.Init exposing
, initDecoder
)
-import Json.Decode as Json exposing ((:=))
+import Json.Decode as Decode exposing (Decoder)
import Model.Payment exposing (Payments, paymentsDecoder)
-import Model.Income exposing (Incomes, incomesDecoder)
import Model.User exposing (Users, UserId, usersDecoder, userIdDecoder)
+import Model.Income exposing (Incomes, incomesDecoder)
+import Model.Category exposing (Categories, categoriesDecoder)
+import Model.PaymentCategory exposing (PaymentCategories, paymentCategoriesDecoder)
type alias Init =
{ users : Users
, me : UserId
, payments : Payments
, incomes : Incomes
+ , categories : Categories
+ , paymentCategories : PaymentCategories
}
-initDecoder : Json.Decoder Init
+initDecoder : Decoder Init
initDecoder =
- Json.object4 Init
- ("users" := usersDecoder)
- ("me" := userIdDecoder)
- ("payments" := paymentsDecoder)
- ("incomes" := incomesDecoder)
+ Decode.map6 Init
+ (Decode.field "users" usersDecoder)
+ (Decode.field "me" userIdDecoder)
+ (Decode.field "payments" paymentsDecoder)
+ (Decode.field "incomes" incomesDecoder)
+ (Decode.field "categories" categoriesDecoder)
+ (Decode.field "paymentCategories" paymentCategoriesDecoder)