Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
58422697
Commit
58422697
authored
Mar 12, 2018
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login - always logs in
parent
3db3dd30
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Login.purs
src/Login.purs
+11
-9
No files found.
src/Login.purs
View file @
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 }
case res of
Left e -> do
lift $ log $ show e
modifyState \(State s) -> State $ s { errorMessage = e}
Right r@(LoginRes response) -> do
lift $ setHash "/addCorpus"
lift $ setHash "/addCorpus"
modifyState \(State s) -> State $ s {response = r, errorMessage = ""}
modifyState id
-- res <- lift $ loginReq $ LoginReq { username : state.username, password : state.password }
-- case res of
-- Left e -> do
-- lift $ log $ show e
-- modifyState \(State s) -> State $ s { errorMessage = e}
-- Right r@(LoginRes response) -> do
-- lift $ setHash "/addCorpus"
-- modifyState \(State s) -> State $ s {response = r, errorMessage = ""}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment