diff options
Diffstat (limited to 'src/client/elm/Model.elm')
-rw-r--r-- | src/client/elm/Model.elm | 16 |
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 |