Skip to content
GitLab
Menu
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
0533a6e7
Commit
0533a6e7
authored
Mar 08, 2017
by
Wietse Kuipers
Browse files
New login URL
parent
6cc55921
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/actions/login.js
View file @
0533a6e7
import
*
as
types
from
'
./actionTypes
'
;
const
apiKey
=
'
AiYinaeng4juw1cae1eiLe2Adei2Ahbahda3AiRu
'
;
export
function
loginSuccess
(
username
,
token
)
{
return
{
type
:
types
.
LOGINSUCCESS
,
...
...
@@ -35,17 +33,16 @@ export function login(username, password) {
'
Content-Type
'
:
'
application/json
'
,
},
body
:
JSON
.
stringify
({
apikey
:
apiKey
,
username
,
password
,
}),
};
return
fetch
(
'
http://localhost:8000/api/
login
'
,
data
)
return
fetch
(
'
http://localhost:8000/api/
token-auth
'
,
data
)
.
then
(
response
=>
response
.
json
())
.
then
(
(
responseJson
)
=>
{
if
(
responseJson
.
status
===
'
ok
'
)
{
if
(
responseJson
.
token
)
{
return
dispatch
(
loginSuccess
(
username
,
responseJson
.
token
));
}
return
dispatch
(
loginFailure
());
...
...
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