diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/elm/DecodeFlags.elm | 19 | ||||
-rw-r--r-- | src/client/static/elm.js | 16 |
2 files changed, 16 insertions, 19 deletions
diff --git a/src/client/elm/DecodeFlags.elm b/src/client/elm/DecodeFlags.elm index 5acc4f9..7709e5d 100644 --- a/src/client/elm/DecodeFlags.elm +++ b/src/client/elm/DecodeFlags.elm @@ -1,6 +1,6 @@ module DecodeFlags exposing (Flags, init) -import Json.Decode exposing (Decoder, andThen, fail, string, succeed) +import Json.Decode exposing (Decoder, andThen, decodeValue, fail, list, string, succeed) import Json.Decode.Pipeline exposing (decode, required) import Model exposing (..) @@ -11,7 +11,7 @@ type alias Flags = init : Flags -> ( Model, Cmd msg ) init flags = - case Json.Decode.decodeValue decodeUsers flags of + case decodeValue decodeUsers flags of Ok user -> ( Model user, Cmd.none ) @@ -21,17 +21,14 @@ init flags = decodeUsers : Decoder (List User) decodeUsers = - Json.Decode.list decodeUser + list + (decode User + |> required "type" decodeUserType + |> required "value" string + ) -decodeUser : Decoder User -decodeUser = - decode User - |> required "type" decodeUserType - |> required "value" string - - -decodeUserType : Json.Decode.Decoder UserType +decodeUserType : Decoder UserType decodeUserType = string |> andThen diff --git a/src/client/static/elm.js b/src/client/static/elm.js index 99bf4cb..4447609 100644 --- a/src/client/static/elm.js +++ b/src/client/static/elm.js @@ -7909,16 +7909,16 @@ var _user$project$DecodeFlags$decodeUserType = A2( } }, _elm_lang$core$Json_Decode$string); -var _user$project$DecodeFlags$decodeUser = A3( - _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'value', - _elm_lang$core$Json_Decode$string, +var _user$project$DecodeFlags$decodeUsers = _elm_lang$core$Json_Decode$list( A3( _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, - 'type', - _user$project$DecodeFlags$decodeUserType, - _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Model$User))); -var _user$project$DecodeFlags$decodeUsers = _elm_lang$core$Json_Decode$list(_user$project$DecodeFlags$decodeUser); + 'value', + _elm_lang$core$Json_Decode$string, + A3( + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$required, + 'type', + _user$project$DecodeFlags$decodeUserType, + _NoRedInk$elm_decode_pipeline$Json_Decode_Pipeline$decode(_user$project$Model$User)))); var _user$project$DecodeFlags$init = function (flags) { var _p1 = A2(_elm_lang$core$Json_Decode$decodeValue, _user$project$DecodeFlags$decodeUsers, flags); if (_p1.ctor === 'Ok') { |