2019-07-22 22:53:30 +00:00
|
|
|
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-07-22 22:53:30 +00:00
|
|
|
|
2019-12-29 20:55:12 +00:00
|
|
|
update : Flags -> Msg -> Model -> ( Model, Cmd Msg )
|
2019-07-22 22:53:30 +00:00
|
|
|
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 )
|
2019-07-22 22:53:30 +00:00
|
|
|
in
|
2020-01-06 23:20:28 +00:00
|
|
|
( m2, cmd )
|
2019-07-22 22:53:30 +00:00
|
|
|
|
|
|
|
ChangePassMsg m ->
|
|
|
|
let
|
2019-12-29 20:55:12 +00:00
|
|
|
( m2, c2 ) =
|
|
|
|
Comp.ChangePasswordForm.update flags m model.changePassModel
|
2019-07-22 22:53:30 +00:00
|
|
|
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 )
|