1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 01:57:02 +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

@@ -1,6 +1,5 @@
module Data.Session exposing
( Flash
, Msg(..)
, Persistent
, Session
, addRecent
@@ -10,9 +9,7 @@ module Data.Session exposing
, disableRouting
, enableRouting
, init
, none
, showFlash
, update
)
import Browser.Navigation as Nav
@@ -46,10 +43,6 @@ type alias Persistent =
}
type Msg
= None
init : Nav.Key -> Url -> Persistent -> Session
init key location persistent =
{ key = key
@@ -61,29 +54,6 @@ init key location persistent =
}
update : Msg -> Session -> ( Session, Cmd a )
update msg session =
let
newSession =
case msg of
None ->
session
in
if session.persistent == newSession.persistent then
-- No change
( newSession, Cmd.none )
else
( newSession
, Ports.storeSession (encode newSession.persistent)
)
none : Msg
none =
None
addRecent : String -> Session -> Session
addRecent mailbox session =
if List.head session.persistent.recentMailboxes == Just mailbox then