aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Main.elm
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/Main.elm')
-rw-r--r--src/client/elm/Main.elm26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/client/elm/Main.elm b/src/client/elm/Main.elm
index 06b5ec3..c3d5192 100644
--- a/src/client/elm/Main.elm
+++ b/src/client/elm/Main.elm
@@ -7,6 +7,7 @@ import Graphics.Element exposing (..)
import Html exposing (Html)
import StartApp exposing (App)
import Effects exposing (Effects, Never)
+import Json.Decode as Json
import Task exposing (..)
import Time exposing (..)
@@ -20,18 +21,26 @@ import View exposing (view)
import Server
+import Utils.Maybe exposing (isJust)
+
main : Signal Html
main = app.html
app : App Model
app = StartApp.start
{ init =
- ( initialModel initialTime translations conf
- , Server.init
- |> Task.map GoLoggedInView
- |> flip Task.onError (always <| Task.succeed GoSignInView)
- |> Effects.task
- )
+ case Json.decodeString Json.string signInError of
+ Ok signInError ->
+ ( initialModel initialTime translations conf (Just signInError)
+ , Effects.none
+ )
+ Err _ ->
+ ( initialModel initialTime translations conf Nothing
+ , Server.init
+ |> Task.map GoLoggedInView
+ |> flip Task.onError (always <| Task.succeed GoSignInView)
+ |> Effects.task
+ )
, view = view
, update = update
, inputs = [ Signal.map UpdateTime (Time.every 1000) ]
@@ -45,7 +54,4 @@ port tasks = app.tasks
port initialTime : Time
port translations : String
port conf : String
-
--- Output ports
-
-port signInError : Maybe String
+port signInError : String