aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model/Init.elm
diff options
context:
space:
mode:
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)