diff options
author | Joris | 2016-03-23 00:45:33 +0100 |
---|---|---|
committer | Joris | 2016-03-23 00:46:53 +0100 |
commit | a11ad41b52ed3682d33382f2a378bf3294d688b2 (patch) | |
tree | f1d0f7835965ebcc6a61225186cad6b5de565bca /src/client/elm/Model.elm | |
parent | 32db6a74d8578f993dd1cce3367fc7615ec730cd (diff) |
Sign in token link to /
Diffstat (limited to 'src/client/elm/Model.elm')
-rw-r--r-- | src/client/elm/Model.elm | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/client/elm/Model.elm b/src/client/elm/Model.elm index 5dc6692..7852c9a 100644 --- a/src/client/elm/Model.elm +++ b/src/client/elm/Model.elm @@ -7,9 +7,12 @@ import Time exposing (Time) import Json.Decode as Json import Model.View exposing (..) +import Model.View.SignInView exposing (initSignInView) import Model.Translations exposing (..) import Model.Conf exposing (..) +import Utils.Maybe exposing (isJust) + type alias Model = { view : View , currentTime : Time @@ -17,16 +20,19 @@ type alias Model = , conf : Conf } -initialModel : Time -> String -> String -> Model -initialModel initialTime translationsValue confValue = - { view = LoadingView +initialModel : Time -> String -> String -> Maybe String -> Model +initialModel initialTime translations conf mbSignInError = + { view = + if isJust mbSignInError + then SignInView (initSignInView mbSignInError) + else LoadingView , currentTime = initialTime , translations = - case Json.decodeString translationsDecoder translationsValue of + case Json.decodeString translationsDecoder translations of Ok translations -> translations - Err err -> [] + Err _ -> [] , conf = - case Json.decodeString confDecoder confValue of + case Json.decodeString confDecoder conf of Ok conf -> conf - Err err -> { currency = "" } + Err _ -> { currency = "" } } |