aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Main.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Main.elm')
-rw-r--r--src/client/elm/Main.elm22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/client/elm/Main.elm b/src/client/elm/Main.elm
index 561ea91..0813573 100644
--- a/src/client/elm/Main.elm
+++ b/src/client/elm/Main.elm
@@ -17,6 +17,7 @@ import Server
import Mailbox
import Action exposing (..)
import Model exposing (Model, initialModel)
+import Model.InitResult as InitResult exposing (initResultDecoder)
import Update exposing (update, routerConfig)
import View exposing (view)
@@ -28,7 +29,7 @@ main = app.html
app : App Model
app = StartApp.start
- { init = initData `Effects.andThen` initRouter
+ { init = (initData, Effects.none) `Effects.andThen` initRouter
, view = view
, update = update
, inputs =
@@ -40,20 +41,13 @@ app = StartApp.start
-- Init
-initData : (Model, Effects Action)
+initData : Model
initData =
- case Json.decodeString Json.string signInError of
- Ok signInError ->
- ( initialModel initialTime translations conf (Just signInError)
- , Effects.none
- )
+ case Json.decodeString initResultDecoder initResult of
+ Ok init ->
+ initialModel initialTime translations conf init
Err _ ->
- ( initialModel initialTime translations conf Nothing
- , Server.init
- |> Task.map GoLoggedInView
- |> flip Task.onError (always <| Task.succeed GoSignInView)
- |> Effects.task
- )
+ initialModel initialTime translations conf InitResult.InitEmpty
initRouter : Model -> (Model, Effects Action)
initRouter model = TransitRouter.init routerConfig location model
@@ -68,5 +62,5 @@ port tasks = app.tasks
port initialTime : Time
port translations : String
port conf : String
-port signInError : String
+port initResult : String
port location : String