Files
planka/client/src/sagas/login/services/login.js
T

23 lines
556 B
JavaScript

import { call, put } from 'redux-saga/effects';
import { authenticate, clearAuthenticateError } from '../../../actions';
import api from '../../../api';
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));
}
export function* clearAuthenticateErrorService() {
yield put(clearAuthenticateError());
}