1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 13:19:44 +02:00

Add file attachments

This commit is contained in:
Maksim Eltyshev 2020-04-21 05:04:34 +05:00
parent 202abacaec
commit 6a68ec9c1e
103 changed files with 1847 additions and 305 deletions

View file

@ -0,0 +1,40 @@
import { call, put, select } from 'redux-saga/effects';
import {
createAttachmentRequest,
deleteAttachmentRequest,
updateAttachmentRequest,
} from '../requests';
import { pathSelector } from '../../../selectors';
import { createAttachment, deleteAttachment, updateAttachment } from '../../../actions';
import { createLocalId } from '../../../utils/local-id';
export function* createAttachmentService(cardId, data) {
const localId = yield call(createLocalId);
yield put(
createAttachment({
cardId,
id: localId,
name: data.file.name,
}),
);
yield call(createAttachmentRequest, cardId, localId, data);
}
export function* createAttachmentInCurrentCardService(data) {
const { cardId } = yield select(pathSelector);
yield call(createAttachmentService, cardId, data);
}
export function* updateAttachmentService(id, data) {
yield put(updateAttachment(id, data));
yield call(updateAttachmentRequest, id, data);
}
export function* deleteAttachmentService(id) {
yield put(deleteAttachment(id));
yield call(deleteAttachmentRequest, id);
}