1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 18:17:03 +00:00

ui: Easy renames and refactors

This commit is contained in:
James Hillyerd
2018-11-18 18:52:14 -08:00
parent 0ed0cd2d64
commit 5be2b57a12
11 changed files with 150 additions and 164 deletions

View File

@@ -19,32 +19,31 @@ type alias Model =
init : ( Model, Cmd Msg )
init =
let
cmdGreeting =
Http.get
{ url = "/serve/greeting"
, expect = Http.expectString GreetingLoaded
}
in
( Model "", cmdGreeting )
cmdGreeting : Cmd Msg
cmdGreeting =
Http.get
{ url = "/serve/greeting"
, expect = Http.expectString GreetingResult
}
-- UPDATE --
type Msg
= GreetingResult (Result Http.Error String)
= GreetingLoaded (Result Http.Error String)
update : Session -> Msg -> Model -> ( Model, Cmd Msg, Session.Msg )
update session msg model =
case msg of
GreetingResult (Ok greeting) ->
GreetingLoaded (Ok greeting) ->
( Model greeting, Cmd.none, Session.none )
GreetingResult (Err err) ->
GreetingLoaded (Err err) ->
( model, Cmd.none, Session.SetFlash (HttpUtil.errorString err) )