aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View/SignIn.elm
blob: 8fcac165b6358bceb115cc6fbd159e1913db02c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module View.SignIn
  ( renderSignIn
  ) where

import Html as H exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)

import Json.Decode as Json

import Update exposing (..)
import Update.SignIn exposing (..)

import ServerCommunication as SC
import ServerCommunication exposing (serverCommunications)

import Model exposing (Model)
import Model.View.SignInView exposing (..)
import Model.Translations exposing (getMessage)

import View.Events exposing (onSubmitPrevDefault)

renderSignIn : Model -> SignInView -> Html
renderSignIn model signInView =
  div
    [ class "signIn" ]
    [ div
        [ class "result" ]
        [ signInResult model signInView ]
    ]

signInResult : Model -> SignInView -> Html
signInResult model signInView =
  case signInView.result of
    Just result ->
      case result of
        Ok login ->
          div
            [ class "success" ]
            [ text (getMessage "SignInEmailSent" model.translations) ]
        Err error ->
          div
            [ class "error" ]
            [ text error ]
    Nothing ->
      text ""