Fix APIClient
This commit is contained in:
parent
88e8a8b8a3
commit
8ba45f84cb
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user