17 lines
455 B
JavaScript
17 lines
455 B
JavaScript
|
import { put, call } from 'redux-saga/effects';
|
||
|
import { FETCH_PROJECTS_SUCCESS, FETCH_PROJECTS_FAILURE } from '../actions/projects';
|
||
|
import { gitea } from '../../util/gitea';
|
||
|
|
||
|
export function* fetchProjectsSaga() {
|
||
|
|
||
|
let projects;
|
||
|
try {
|
||
|
projects = yield call(gitea.fetchUserProjects.bind(gitea))
|
||
|
} catch(error) {
|
||
|
yield put({ type: FETCH_PROJECTS_FAILURE, error });
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
yield put({ type: FETCH_PROJECTS_SUCCESS, projects });
|
||
|
}
|