Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
ThaliApp
Commits
ea6d6756
Commit
ea6d6756
authored
Feb 16, 2017
by
Wietse Kuipers
Browse files
async login example
parent
56e0f910
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/actions/login.js
View file @
ea6d6756
import
*
as
types
from
'
./actionTypes
'
;
export
function
login
(
username
,
password
)
{
export
function
login
old
(
username
,
password
)
{
return
{
type
:
types
.
LOGIN
,
success
:
password
===
'
42
'
,
};
}
export
function
login
(
username
,
password
)
{
return
(
dispatch
)
=>
{
return
fetch
(
'
https://thalia.nu/api/login
'
,
{
method
:
'
POST
'
,
})
.
then
(
response
=>
response
.
json
())
.
then
(
(
responseJson
)
=>
{
console
.
log
(
responseJson
);
return
dispatch
(
loginold
(
username
,
password
));
})
.
catch
(
error
=>
console
.
error
(
error
));
};
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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