mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
ref: Refactoring
This commit is contained in:
parent
aa4723d7fe
commit
3f8216dca8
189 changed files with 3781 additions and 3486 deletions
72
client/src/sagas/core/requests/boards.js
Normal file
72
client/src/sagas/core/requests/boards.js
Normal file
|
@ -0,0 +1,72 @@
|
|||
import { call, select } from 'redux-saga/effects';
|
||||
|
||||
import request from '../request';
|
||||
import selectors from '../../../selectors';
|
||||
import api from '../../../api';
|
||||
import Paths from '../../../constants/Paths';
|
||||
|
||||
export function* fetchBoardByCurrentPath() {
|
||||
const pathsMatch = yield select(selectors.selectPathsMatch);
|
||||
|
||||
let board;
|
||||
let card;
|
||||
let users;
|
||||
let projects;
|
||||
let boardMemberships;
|
||||
let labels;
|
||||
let lists;
|
||||
let cards;
|
||||
let cardMemberships;
|
||||
let cardLabels;
|
||||
let tasks;
|
||||
let attachments;
|
||||
|
||||
if (pathsMatch) {
|
||||
let boardId;
|
||||
if (pathsMatch.path === Paths.BOARDS) {
|
||||
boardId = pathsMatch.params.id;
|
||||
} else if (pathsMatch.path === Paths.CARDS) {
|
||||
({
|
||||
item: card,
|
||||
item: { boardId },
|
||||
} = yield call(request, api.getCard, pathsMatch.params.id));
|
||||
}
|
||||
|
||||
if (boardId) {
|
||||
({
|
||||
item: board,
|
||||
included: {
|
||||
users,
|
||||
projects,
|
||||
boardMemberships,
|
||||
labels,
|
||||
lists,
|
||||
cards,
|
||||
cardMemberships,
|
||||
cardLabels,
|
||||
tasks,
|
||||
attachments,
|
||||
},
|
||||
} = yield call(request, api.getBoard, boardId));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
board,
|
||||
card,
|
||||
users,
|
||||
boardMemberships,
|
||||
labels,
|
||||
lists,
|
||||
cards,
|
||||
cardMemberships,
|
||||
cardLabels,
|
||||
tasks,
|
||||
attachments,
|
||||
project: projects[0],
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
fetchBoardByCurrentPath,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue