Commit 7a1e7800 authored by Alexandre Delanoë's avatar Alexandre Delanoë
parents 2dd13953 58422697
...@@ -19,7 +19,7 @@ import Data.MediaType.Common (applicationJSON) ...@@ -19,7 +19,7 @@ import Data.MediaType.Common (applicationJSON)
import Network.HTTP.Affjax (AJAX, affjax, defaultRequest) import Network.HTTP.Affjax (AJAX, affjax, defaultRequest)
import Network.HTTP.RequestHeader (RequestHeader(..)) import Network.HTTP.RequestHeader (RequestHeader(..))
import Prelude hiding (div) import Prelude hiding (div)
import React.DOM (a, button, div, form, h2, h4, i, input, label, p, span, text) import React.DOM (a, button, div, h2, h4, i, input, label, p, span, text)
import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, onInput, placeholder, target, value) import React.DOM.Props (_id, _type, className, href, maxLength, name, onClick, onInput, placeholder, target, value)
import Routing.Hash.Aff (setHash) import Routing.Hash.Aff (setHash)
import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec) import Thermite (PerformAction, Render, Spec, modifyState, simpleSpec)
...@@ -63,14 +63,16 @@ performAction (SetPassword pwd) _ _ = void do ...@@ -63,14 +63,16 @@ performAction (SetPassword pwd) _ _ = void do
performAction Login _ (State state) = void do performAction Login _ (State state) = void do
res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password } lift $ setHash "/addCorpus"
case res of modifyState id
Left e -> do -- res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password }
lift $ log $ show e -- case res of
modifyState \(State s) -> State $ s { errorMessage = e} -- Left e -> do
Right r@(LoginRes response) -> do -- lift $ log $ show e
lift $ setHash "/addCorpus" -- modifyState \(State s) -> State $ s { errorMessage = e}
modifyState \(State s) -> State $ s {response = r, errorMessage = ""} -- Right r@(LoginRes response) -> do
-- lift $ setHash "/addCorpus"
-- modifyState \(State s) -> State $ s {response = r, errorMessage = ""}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment