Fix APIClient

This commit is contained in:
wpetit 2020-02-25 10:15:59 +01:00
parent 88e8a8b8a3
commit 8ba45f84cb
2 changed files with 3 additions and 3 deletions

View File

@ -9,6 +9,7 @@ export function* loginSaga(action) {
try {
result = yield call(client.login, action.username, action.password);
} catch(err) {
console.error(err);
yield put(loginFailure(action.username, err));
yield put(addMessage('danger', "Une erreur inconnue bloque le fonctionnement normal de l'application. Veuillez réessayer plus tard."));
return
@ -44,4 +45,3 @@ export function* logoutSaga(action) {
yield put(logoutSuccess(action.username));
}

View File

@ -38,13 +38,13 @@ export class APIClient {
}
_callAPI(path, body, method='GET') {
return fetch(baseURL + path, {
return fetch(this.baseURL + path, {
method,
headers: {
'Content-Type': 'application/json',
},
mode: 'cors',
credentials: true,
credentials: 'include',
body: JSON.stringify(body),
})
.then(res => res.json())