Initial commit

This commit is contained in:
Maksim Eltyshev
2019-08-31 04:07:25 +05:00
commit 36fe34e8e1
583 changed files with 91539 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import { call, put } from 'redux-saga/effects';
import request from './request';
import {
fetchProjectsFailed,
fetchProjectsRequested,
fetchProjectsSucceeded,
} from '../../../actions';
import api from '../../../api';
// eslint-disable-next-line import/prefer-default-export
export function* fetchProjectsRequest() {
yield put(fetchProjectsRequested());
try {
const {
items,
included: { users, projectMemberships, boards },
} = yield call(request, api.getProjects);
const action = fetchProjectsSucceeded(items, users, projectMemberships, boards);
yield put(action);
return {
success: true,
payload: action.payload,
};
} catch (error) {
const action = fetchProjectsFailed(error);
yield put(action);
return {
success: false,
payload: action.payload,
};
}
}