mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-29 02:42:23 +03:00
38 lines
897 B
Elm
38 lines
897 B
Elm
module Update exposing (Msg(..), subscriptions, update)
|
|
|
|
import Model exposing (..)
|
|
import NriModules as NriModules
|
|
import Routes as Routes exposing (Route)
|
|
|
|
|
|
type Msg
|
|
= UpdateModuleStates NriModules.Msg
|
|
| UrlChanged Route
|
|
| NoOp
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
|
update action model =
|
|
case action of
|
|
UpdateModuleStates msg ->
|
|
let
|
|
( moduleStates, cmd ) =
|
|
NriModules.update msg model.moduleStates
|
|
in
|
|
( { model | moduleStates = moduleStates }
|
|
, Cmd.map UpdateModuleStates cmd
|
|
)
|
|
|
|
UrlChanged route ->
|
|
( { model | route = route }
|
|
, Cmd.none
|
|
)
|
|
|
|
NoOp ->
|
|
( model, Cmd.none )
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
subscriptions model =
|
|
Sub.map UpdateModuleStates (NriModules.subscriptions model.moduleStates)
|