@@ -7,7 +7,7 @@ import actions from '../../../actions';
|
||||
import api from '../../../api';
|
||||
import { createLocalId } from '../../../utils/local-id';
|
||||
|
||||
export function* createBoard(projectId, data) {
|
||||
export function* createBoard(projectId, { import: boardImport, ...data }) {
|
||||
const nextData = {
|
||||
...data,
|
||||
position: yield select(selectors.selectNextBoardPosition, projectId),
|
||||
@@ -30,7 +30,19 @@ export function* createBoard(projectId, data) {
|
||||
({
|
||||
item: board,
|
||||
included: { boardMemberships },
|
||||
} = yield call(request, api.createBoard, projectId, nextData));
|
||||
} = yield boardImport
|
||||
? call(
|
||||
request,
|
||||
api.createBoardWithImport,
|
||||
projectId,
|
||||
{
|
||||
...nextData,
|
||||
importType: boardImport.type,
|
||||
importFile: boardImport.file,
|
||||
},
|
||||
localId,
|
||||
)
|
||||
: call(request, api.createBoard, projectId, nextData));
|
||||
} catch (error) {
|
||||
yield put(actions.createBoard.failure(localId, error));
|
||||
return;
|
||||
@@ -46,8 +58,12 @@ export function* createBoardInCurrentProject(data) {
|
||||
yield call(createBoard, projectId, data);
|
||||
}
|
||||
|
||||
export function* handleBoardCreate(board) {
|
||||
yield put(actions.handleBoardCreate(board));
|
||||
export function* handleBoardCreate(board, requestId) {
|
||||
const isExists = yield select(selectors.selectIsBoardWithIdExists, requestId);
|
||||
|
||||
if (!isExists) {
|
||||
yield put(actions.handleBoardCreate(board));
|
||||
}
|
||||
}
|
||||
|
||||
export function* fetchBoard(id) {
|
||||
|
||||
@@ -8,8 +8,8 @@ export default function* boardsWatchers() {
|
||||
takeEvery(EntryActionTypes.BOARD_IN_CURRENT_PROJECT_CREATE, ({ payload: { data } }) =>
|
||||
services.createBoardInCurrentProject(data),
|
||||
),
|
||||
takeEvery(EntryActionTypes.BOARD_CREATE_HANDLE, ({ payload: { board } }) =>
|
||||
services.handleBoardCreate(board),
|
||||
takeEvery(EntryActionTypes.BOARD_CREATE_HANDLE, ({ payload: { board, requestId } }) =>
|
||||
services.handleBoardCreate(board, requestId),
|
||||
),
|
||||
takeEvery(EntryActionTypes.BOARD_FETCH, ({ payload: { id } }) => services.fetchBoard(id)),
|
||||
takeEvery(EntryActionTypes.BOARD_UPDATE, ({ payload: { id, data } }) =>
|
||||
|
||||
@@ -48,8 +48,8 @@ const createSocketEventsChannel = () =>
|
||||
emit(entryActions.handleProjectManagerDelete(item));
|
||||
};
|
||||
|
||||
const handleBoardCreate = ({ item }) => {
|
||||
emit(entryActions.handleBoardCreate(item));
|
||||
const handleBoardCreate = ({ item, requestId }) => {
|
||||
emit(entryActions.handleBoardCreate(item, requestId));
|
||||
};
|
||||
|
||||
const handleBoardUpdate = ({ item }) => {
|
||||
|
||||
Reference in New Issue
Block a user