aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm
diff options
context:
space:
mode:
authorJoris2016-01-01 14:39:40 +0100
committerJoris2016-01-01 14:39:40 +0100
commit0d0c99fd28b782c7daf02fb5cc48d3eb252e705d (patch)
tree93f9836152b6db9fc7a7af34ceb1dde920b1f3c3 /src/client/elm
parent5f3d75406ef36924616e3289342647f4939d5004 (diff)
Simplify persona usage
Diffstat (limited to 'src/client/elm')
-rw-r--r--src/client/elm/Persona.elm3
-rw-r--r--src/client/elm/ServerCommunication.elm8
-rw-r--r--src/client/elm/Update.elm5
-rw-r--r--src/client/elm/View/Header.elm4
4 files changed, 7 insertions, 13 deletions
diff --git a/src/client/elm/Persona.elm b/src/client/elm/Persona.elm
index 51b5fc6..e55d1b2 100644
--- a/src/client/elm/Persona.elm
+++ b/src/client/elm/Persona.elm
@@ -8,7 +8,6 @@ module Persona
type Operation =
NoOp
| SignIn
- | SignOut
operations : Signal.Mailbox Operation
operations = Signal.mailbox NoOp
@@ -17,12 +16,10 @@ fromString : String -> Operation
fromString str =
case str of
"SignIn" -> SignIn
- "SignOut" -> SignOut
_ -> NoOp
toString : Operation -> String
toString operation =
case operation of
SignIn -> "SignIn"
- SignOut -> "SignOut"
_ -> "NoOp"
diff --git a/src/client/elm/ServerCommunication.elm b/src/client/elm/ServerCommunication.elm
index 74b45e8..62644f8 100644
--- a/src/client/elm/ServerCommunication.elm
+++ b/src/client/elm/ServerCommunication.elm
@@ -14,13 +14,11 @@ import Debug
import SimpleHTTP exposing (..)
-import Persona exposing (operations)
-
import Model.User exposing (UserId)
import Model.Payment exposing (..)
import Model.View.LoggedIn.Add exposing (Frequency(..))
-import Update as U
+import Update as U exposing (actions)
import Update.SignIn exposing (..)
import Update.LoggedIn as UL
import Update.LoggedIn.Monthly as UM
@@ -51,10 +49,6 @@ sendRequest communication =
SignIn assertion ->
post ("/signIn?assertion=" ++ assertion)
|> flip Task.andThen (always initViewAction)
- |> flip Task.onError (\err ->
- Signal.send operations.address Persona.SignOut
- |> flip Task.andThen (always <| Task.fail err)
- )
AddPayment name cost ->
post (addPaymentURL name cost Punctual)
diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm
index ed4b99d..62782a3 100644
--- a/src/client/elm/Update.elm
+++ b/src/client/elm/Update.elm
@@ -20,10 +20,11 @@ import Update.LoggedIn exposing (..)
type Action =
NoOp
| UpdateTime Time
+ | GoLoadingView
| GoSignInView
+ | GoLoggedInView Users UserId Payments Payments Int Payers
| SignInError String
| UpdateSignIn SignInAction
- | GoLoggedInView Users UserId Payments Payments Int Payers
| UpdateLoggedIn LoggedAction
actions : Signal.Mailbox Action
@@ -36,6 +37,8 @@ updateModel action model =
model
UpdateTime time ->
{ model | currentTime = time }
+ GoLoadingView ->
+ { model | view = V.LoadingView }
GoSignInView ->
{ model | view = V.SignInView initSignInView }
GoLoggedInView users me monthlyPayments payments paymentsCount payers ->
diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm
index 94bdb01..0cc2137 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/elm/View/Header.elm
@@ -6,7 +6,7 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
-import Persona exposing (operations)
+import ServerCommunication as SC exposing (serverCommunications)
import Model exposing (Model)
import Model.View exposing (..)
@@ -25,7 +25,7 @@ renderHeader model =
LoggedInView _ ->
button
[ class "icon"
- , onClick operations.address Persona.SignOut
+ , onClick serverCommunications.address SC.SignOut
]
[ renderIcon "power-off" ]
_ ->