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

ui: Reimplement session storage in Main

This commit is contained in:
James Hillyerd
2018-12-31 16:16:20 -08:00
parent c2109a8df0
commit c977ded5ba
2 changed files with 25 additions and 1 deletions

View File

@@ -130,7 +130,30 @@ update msg model =
let
session =
getSession model
( newModel, cmd ) =
updateMain msg model session
newSession =
getSession newModel
in
if session.persistent == newSession.persistent then
( newModel, cmd )
else
-- Store updated persistent session.
( newModel
, Cmd.batch
[ Ports.storeSession (Session.encode newSession.persistent)
, cmd
]
)
{-| Handle global/navbar related msgs.
-}
updateMain : Msg -> Model -> Session -> ( Model, Cmd Msg )
updateMain msg model session =
case msg of
LinkClicked req ->
case req of
@@ -197,7 +220,7 @@ update msg model =
updatePage msg model
{-| Delegates incoming messages to their respective sub-pages.
{-| Delegate incoming messages to their respective sub-pages.
-}
updatePage : Msg -> Model -> ( Model, Cmd Msg )
updatePage msg model =