docspell/modules/webapp/src/main/elm/Page/UserSettings/Update.elm

44 lines
1.4 KiB
Elm
Raw Normal View History

module Page.UserSettings.Update exposing (update)
import Comp.ChangePasswordForm
2020-01-04 23:12:23 +00:00
import Comp.EmailSettingsManage
2019-12-29 20:55:12 +00:00
import Data.Flags exposing (Flags)
import Page.UserSettings.Data exposing (..)
2019-12-29 20:55:12 +00:00
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
update flags msg model =
case msg of
SetTab t ->
let
2019-12-29 20:55:12 +00:00
m =
{ model | currentTab = Just t }
2020-01-06 23:20:28 +00:00
( m2, cmd ) =
case t of
EmailSettingsTab ->
let
( em, c ) =
Comp.EmailSettingsManage.init flags
in
( { m | emailSettingsModel = em }, Cmd.map EmailSettingsMsg c )
ChangePassTab ->
( m, Cmd.none )
in
2020-01-06 23:20:28 +00:00
( m2, cmd )
ChangePassMsg m ->
let
2019-12-29 20:55:12 +00:00
( m2, c2 ) =
Comp.ChangePasswordForm.update flags m model.changePassModel
in
2019-12-29 20:55:12 +00:00
( { model | changePassModel = m2 }, Cmd.map ChangePassMsg c2 )
2020-01-04 23:12:23 +00:00
EmailSettingsMsg m ->
let
( m2, c2 ) =
Comp.EmailSettingsManage.update flags m model.emailSettingsModel
in
( { model | emailSettingsModel = m2 }, Cmd.map EmailSettingsMsg c2 )