aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Model.elm
diff options
context:
space:
mode:
authorJoris2016-03-23 00:45:33 +0100
committerJoris2016-03-23 00:46:53 +0100
commita11ad41b52ed3682d33382f2a378bf3294d688b2 (patch)
treef1d0f7835965ebcc6a61225186cad6b5de565bca /src/client/elm/Model.elm
parent32db6a74d8578f993dd1cce3367fc7615ec730cd (diff)
downloadbudget-a11ad41b52ed3682d33382f2a378bf3294d688b2.tar.gz
budget-a11ad41b52ed3682d33382f2a378bf3294d688b2.tar.bz2
budget-a11ad41b52ed3682d33382f2a378bf3294d688b2.zip
Sign in token link to /
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 = "" }
}