aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Update.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Update.elm')
-rw-r--r--src/client/elm/Update.elm21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm
index 5cac028..7d56b36 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/elm/Update.elm
@@ -1,10 +1,15 @@
module Update
- ( update
+ ( routerConfig
+ , update
) where
import Task
import Effects exposing (Effects)
+import TransitRouter
+import RouteParser
+
+import Route exposing (Route)
import Server
@@ -24,6 +29,14 @@ import SignIn.Update as SignInUpdate
import Utils.Http exposing (errorKey)
+routerConfig : TransitRouter.Config Route Action Model
+routerConfig =
+ { mountRoute = \_ _ model -> (model, Effects.none)
+ , getDurations = \_ _ _ -> (50, 200)
+ , actionWrapper = RouterAction
+ , routeDecoder = Maybe.withDefault Route.Home << RouteParser.match Route.matchers
+ }
+
update : Action -> Model -> (Model, Effects Action)
update action model =
case action of
@@ -58,6 +71,12 @@ update action model =
UpdateLoggedIn loggedInAction ->
applyLoggedIn model loggedInAction
+ RouterAction routeAction ->
+ TransitRouter.update
+ routerConfig
+ (Debug.log "routeAction" routeAction)
+ model
+
SignOut ->
( model
, Server.signOut