From a11ad41b52ed3682d33382f2a378bf3294d688b2 Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 23 Mar 2016 00:45:33 +0100 Subject: Sign in token link to / --- src/client/elm/Model.elm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/client/elm/Model.elm') 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 = "" } } -- cgit v1.2.3