Skip to content

Commit

Permalink
fetch sprints during initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirPal committed Feb 18, 2019
1 parent 23d6ee6 commit b82cbd0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 12 deletions.
9 changes: 8 additions & 1 deletion app/renderer/sagas/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
delay,
cancel,
cancelled,
join,
} from 'redux-saga/effects';
import {
remote,
Expand Down Expand Up @@ -62,6 +63,9 @@ import {
import {
fetchBoards,
} from './boards';
import {
fetchSprints,
} from './sprints';
import {
throwError,
infoLog,
Expand Down Expand Up @@ -255,11 +259,14 @@ export function* takeInitialConfigureApp() {
allowPrerelease: persistSettings.updateChannel !== 'stable',
}));
yield put(updaterActions.checkUpdates());
const boardsTask = yield fork(fetchBoards);
yield call(fetchIssueFields);
yield fork(fetchEpics);
yield fork(fetchProjects);
yield fork(fetchFilters);
yield fork(fetchBoards);

yield join(boardsTask);
yield fork(fetchSprints);

yield put(uiActions.setUiState({
authorized: true,
Expand Down
34 changes: 23 additions & 11 deletions app/renderer/sagas/sprints.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from 'api';
import {
getUiState,
getResourceItemById,
} from 'selectors';
import {
actionTypes,
Expand All @@ -36,18 +37,29 @@ export function* fetchSprints(): Generator<*, *, *> {
yield put(actions.pending());

const boardId: Id = yield select(getUiState('issuesSourceId'));
const response = yield call(
jiraApi.getBoardSprints,
{
params: {
boardId,
state: 'active',
const board = yield select(getResourceItemById('boards', boardId));
if (
boardId
&& board
&& board.type === 'scrum'
) {
const response = yield call(
jiraApi.getBoardSprints,
{
params: {
boardId,
state: 'active',
},
},
},
);
yield put(actions.succeeded({
resources: response.values,
}));
);
yield put(actions.succeeded({
resources: response.values,
}));
} else {
yield put(actions.succeeded({
resources: [],
}));
}
} catch (err) {
yield put(actions.succeeded({
resources: [],
Expand Down

0 comments on commit b82cbd0

Please sign in to comment.