Decode routeOpts from block

This commit is contained in:
stuart nelson 2016-12-12 10:47:22 +01:00
parent 3b166e89e7
commit c22599858a
2 changed files with 15 additions and 2 deletions

View File

@ -83,8 +83,15 @@ unwrapWithDefault default val =
blockDecoder : Json.Decoder Block
blockDecoder =
Json.map Block
Json.map2 Block
(field "alerts" <| Json.list alertDecoder)
(field "routeOpts" routeOptsDecoder)
routeOptsDecoder : Json.Decoder RouteOpts
routeOptsDecoder =
Json.map RouteOpts
(field "receiver" Json.string)
alertDecoder : Json.Decoder Alert

View File

@ -51,7 +51,13 @@ type alias Alert =
type alias Block =
{ alerts : List Alert }
{ alerts : List Alert
, routeOpts : RouteOpts
}
type alias RouteOpts =
{ receiver : String }