Fix silence destroy return expectation

Also remove unused "error" string
This commit is contained in:
stuart nelson 2017-02-08 12:17:50 +01:00
parent eab27236be
commit 7be6c13297
4 changed files with 12 additions and 4 deletions

View File

@ -37,7 +37,7 @@ init location =
route =
Parsing.urlParser location
in
update (urlUpdate location) (Model Loading Loading Loading route "")
update (urlUpdate location) (Model Loading Loading Loading route)
nullSilence : Silence

View File

@ -66,7 +66,7 @@ destroy silence =
Http.emptyBody
-- Body being sent
, expect =
(Http.expectJson Silences.Decoders.create)
(Http.expectJson Silences.Decoders.destroy)
-- Response expected
, timeout =
Nothing

View File

@ -26,6 +26,15 @@ create =
(Json.at [ "data", "silenceId" ] Json.int)
-- This should just be the ID
destroy : Json.Decoder String
destroy =
(Json.at [ "status" ] Json.string)
silence : Json.Decoder Silence
silence =
Json.map7 Silence

View File

@ -18,7 +18,6 @@ type alias Model =
, silence : ApiData Silence
, alertGroups : ApiData (List AlertGroup)
, route : Route
, error : String
}
@ -51,7 +50,7 @@ type Msg
= SilenceFetch (ApiData Silence)
| SilencesFetch (ApiData (List Silence))
| SilenceCreate (Result Http.Error Int)
| SilenceDestroy (Result Http.Error Int)
| SilenceDestroy (Result Http.Error String)
| FetchSilences
| FetchSilence Int
| NewSilence