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:
parent
202abacaec
commit
6a68ec9c1e
103 changed files with 1847 additions and 305 deletions
40
client/src/sagas/app/services/attachment.js
Normal file
40
client/src/sagas/app/services/attachment.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue