1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-24 15:49:46 +02:00
planka/client/src/sagas/login/services/login.js

23 lines
556 B
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
import { call, put } from 'redux-saga/effects';
import { authenticate, clearAuthenticateError } from '../../../actions';
import api from '../../../api';
2019-08-31 04:07:25 +05:00
export function* authenticateService(data) {
yield put(authenticate(data));
let accessToken;
try {
({ item: accessToken } = yield call(api.createAccessToken, data));
} catch (error) {
yield put(authenticate.failure(error));
return;
}
yield put(authenticate.success(accessToken));
2019-08-31 04:07:25 +05:00
}
export function* clearAuthenticateErrorService() {
yield put(clearAuthenticateError());
2019-08-31 04:07:25 +05:00
}