Commit 0533a6e7 authored by Wietse Kuipers's avatar Wietse Kuipers
Browse files

New login URL

parent 6cc55921
import * as types from './actionTypes'; import * as types from './actionTypes';
const apiKey = 'AiYinaeng4juw1cae1eiLe2Adei2Ahbahda3AiRu';
export function loginSuccess(username, token) { export function loginSuccess(username, token) {
return { return {
type: types.LOGINSUCCESS, type: types.LOGINSUCCESS,
...@@ -35,17 +33,16 @@ export function login(username, password) { ...@@ -35,17 +33,16 @@ export function login(username, password) {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
apikey: apiKey,
username, username,
password, password,
}), }),
}; };
return fetch('http://localhost:8000/api/login', data) return fetch('http://localhost:8000/api/token-auth', data)
.then( .then(
response => response.json()) response => response.json())
.then( .then(
(responseJson) => { (responseJson) => {
if (responseJson.status === 'ok') { if (responseJson.token) {
return dispatch(loginSuccess(username, responseJson.token)); return dispatch(loginSuccess(username, responseJson.token));
} }
return dispatch(loginFailure()); return dispatch(loginFailure());
......
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