aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Model.elm')
-rw-r--r--src/client/elm/Model.elm20
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 = "" }
}