mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 09:37:02 +00:00
ui: Reimplement session storage in Main
This commit is contained in:
@@ -7,6 +7,7 @@ module Data.Session exposing
|
|||||||
, decoder
|
, decoder
|
||||||
, disableRouting
|
, disableRouting
|
||||||
, enableRouting
|
, enableRouting
|
||||||
|
, encode
|
||||||
, init
|
, init
|
||||||
, initError
|
, initError
|
||||||
, showFlash
|
, showFlash
|
||||||
|
|||||||
@@ -130,7 +130,30 @@ update msg model =
|
|||||||
let
|
let
|
||||||
session =
|
session =
|
||||||
getSession model
|
getSession model
|
||||||
|
|
||||||
|
( newModel, cmd ) =
|
||||||
|
updateMain msg model session
|
||||||
|
|
||||||
|
newSession =
|
||||||
|
getSession newModel
|
||||||
in
|
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
|
case msg of
|
||||||
LinkClicked req ->
|
LinkClicked req ->
|
||||||
case req of
|
case req of
|
||||||
@@ -197,7 +220,7 @@ update msg model =
|
|||||||
updatePage 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 -> ( Model, Cmd Msg )
|
||||||
updatePage msg model =
|
updatePage msg model =
|
||||||
|
|||||||
Reference in New Issue
Block a user