aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model.elm
diff options
context:
space:
mode:
authorJoris2016-03-31 00:06:50 +0200
committerJoris2016-03-31 00:13:25 +0200
commitc95e19407d492a0d4e9e14e320520fe29ce379e5 (patch)
treeca6a14ad1396af6a4bc36e17ce89278d5dbea0a0 /src/client/elm/Model.elm
parentc542551ad043260e6a4a6569b4af5c748f7b6001 (diff)
downloadbudget-c95e19407d492a0d4e9e14e320520fe29ce379e5.tar.gz
budget-c95e19407d492a0d4e9e14e320520fe29ce379e5.tar.bz2
budget-c95e19407d492a0d4e9e14e320520fe29ce379e5.zip
Add init data in html page
Diffstat (limited to 'src/client/elm/Model.elm')
-rw-r--r--src/client/elm/Model.elm16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/client/elm/Model.elm b/src/client/elm/Model.elm
index 9e3f4a0..b4213d5 100644
--- a/src/client/elm/Model.elm
+++ b/src/client/elm/Model.elm
@@ -12,6 +12,8 @@ import Route exposing (Route)
import Model.View exposing (..)
import Model.Translations exposing (..)
import Model.Conf exposing (..)
+import Model.InitResult exposing (..)
+import LoggedIn.Model as LoggedInModel
import SignIn.Model as SignInModel
@@ -25,12 +27,16 @@ type alias Model =
, transitRouter : TransitRouter.TransitRouter Route
}
-initialModel : Time -> String -> String -> Maybe String -> Model
-initialModel initialTime translations conf mbSignInError =
+initialModel : Time -> String -> String -> InitResult -> Model
+initialModel initialTime translations conf initResult =
{ view =
- if isJust mbSignInError
- then SignInView (SignInModel.init mbSignInError)
- else LoadingView
+ case initResult of
+ InitEmpty ->
+ SignInView (SignInModel.init Nothing)
+ InitSuccess init ->
+ LoggedInView (LoggedInModel.init init)
+ InitError error ->
+ SignInView (SignInModel.init (Just error))
, currentTime = initialTime
, translations =
case Json.decodeString translationsDecoder translations of