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

ui: Remove Session from Main model

This commit is contained in:
James Hillyerd
2018-12-24 13:14:38 -08:00
parent 7c213cd897
commit 2f7194835d
6 changed files with 149 additions and 227 deletions

View File

@@ -20,9 +20,9 @@ type alias Model =
}
init : Session -> ( Model, Cmd Msg, Session.Msg )
init : Session -> ( Model, Cmd Msg )
init session =
( Model session "", Api.getGreeting GreetingLoaded, Session.none )
( Model session "", Api.getGreeting GreetingLoaded )
@@ -33,16 +33,15 @@ type Msg
= GreetingLoaded (Result HttpUtil.Error String)
update : Session -> Msg -> Model -> ( Model, Cmd Msg, Session.Msg )
update session msg model =
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
GreetingLoaded (Ok greeting) ->
( { model | greeting = greeting }, Cmd.none, Session.none )
( { model | greeting = greeting }, Cmd.none )
GreetingLoaded (Err err) ->
( { model | session = Session.showFlash (HttpUtil.errorFlash err) model.session }
, Cmd.none
, Session.none
)
@@ -50,8 +49,8 @@ update session msg model =
-- VIEW --
view : Session -> Model -> { title : String, modal : Maybe (Html msg), content : List (Html Msg) }
view session model =
view : Model -> { title : String, modal : Maybe (Html msg), content : List (Html Msg) }
view model =
{ title = "Inbucket"
, modal = Nothing
, content =