Add file attachments
This commit is contained in:
117
client/src/actions/attachment.js
Normal file
117
client/src/actions/attachment.js
Normal file
@@ -0,0 +1,117 @@
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
|
||||
/* Actions */
|
||||
|
||||
export const createAttachment = (attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_CREATE,
|
||||
payload: {
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateAttachment = (id, data) => ({
|
||||
type: ActionTypes.ATTACHMENT_UPDATE,
|
||||
payload: {
|
||||
id,
|
||||
data,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteAttachment = (id) => ({
|
||||
type: ActionTypes.ATTACHMENT_DELETE,
|
||||
payload: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
|
||||
/* Events */
|
||||
|
||||
export const createAttachmentRequested = (localId, data) => ({
|
||||
type: ActionTypes.ATTACHMENT_CREATE_REQUESTED,
|
||||
payload: {
|
||||
localId,
|
||||
data,
|
||||
},
|
||||
});
|
||||
|
||||
export const createAttachmentSucceeded = (localId, attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_CREATE_SUCCEEDED,
|
||||
payload: {
|
||||
localId,
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
|
||||
export const createAttachmentFailed = (localId, error) => ({
|
||||
type: ActionTypes.ATTACHMENT_CREATE_FAILED,
|
||||
payload: {
|
||||
localId,
|
||||
error,
|
||||
},
|
||||
});
|
||||
|
||||
export const createAttachmentReceived = (attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_CREATE_RECEIVED,
|
||||
payload: {
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateAttachmentRequested = (id, data) => ({
|
||||
type: ActionTypes.ATTACHMENT_UPDATE_REQUESTED,
|
||||
payload: {
|
||||
id,
|
||||
data,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateAttachmentSucceeded = (attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_UPDATE_SUCCEEDED,
|
||||
payload: {
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateAttachmentFailed = (id, error) => ({
|
||||
type: ActionTypes.ATTACHMENT_UPDATE_FAILED,
|
||||
payload: {
|
||||
id,
|
||||
error,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateAttachmentReceived = (attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_UPDATE_RECEIVED,
|
||||
payload: {
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteAttachmentRequested = (id) => ({
|
||||
type: ActionTypes.ATTACHMENT_DELETE_REQUESTED,
|
||||
payload: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteAttachmentSucceeded = (attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_DELETE_SUCCEEDED,
|
||||
payload: {
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteAttachmentFailed = (id, error) => ({
|
||||
type: ActionTypes.ATTACHMENT_DELETE_FAILED,
|
||||
payload: {
|
||||
id,
|
||||
error,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteAttachmentReceived = (attachment) => ({
|
||||
type: ActionTypes.ATTACHMENT_DELETE_RECEIVED,
|
||||
payload: {
|
||||
attachment,
|
||||
},
|
||||
});
|
||||
@@ -76,6 +76,7 @@ export const fetchBoardSucceeded = (
|
||||
cardMemberships,
|
||||
cardLabels,
|
||||
tasks,
|
||||
attachments,
|
||||
) => ({
|
||||
type: ActionTypes.BOARD_FETCH_SUCCEEDED,
|
||||
payload: {
|
||||
@@ -86,6 +87,7 @@ export const fetchBoardSucceeded = (
|
||||
cardMemberships,
|
||||
cardLabels,
|
||||
tasks,
|
||||
attachments,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
23
client/src/actions/entry/attachment.js
Normal file
23
client/src/actions/entry/attachment.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import EntryActionTypes from '../../constants/EntryActionTypes';
|
||||
|
||||
export const createAttachmentInCurrentCard = (data) => ({
|
||||
type: EntryActionTypes.ATTACHMENT_IN_CURRENT_CARD_CREATE,
|
||||
payload: {
|
||||
data,
|
||||
},
|
||||
});
|
||||
|
||||
export const updateAttachment = (id, data) => ({
|
||||
type: EntryActionTypes.ATTACHMENT_UPDATE,
|
||||
payload: {
|
||||
id,
|
||||
data,
|
||||
},
|
||||
});
|
||||
|
||||
export const deleteAttachment = (id) => ({
|
||||
type: EntryActionTypes.ATTACHMENT_DELETE,
|
||||
payload: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
@@ -8,6 +8,7 @@ export * from './list';
|
||||
export * from './label';
|
||||
export * from './card';
|
||||
export * from './task';
|
||||
export * from './attachment';
|
||||
export * from './actions';
|
||||
export * from './comment-action';
|
||||
export * from './notification';
|
||||
|
||||
@@ -63,10 +63,10 @@ export const clearCurrentUserUsernameUpdateError = () => ({
|
||||
payload: {},
|
||||
});
|
||||
|
||||
export const uploadCurrentUserAvatar = (file) => ({
|
||||
type: EntryActionTypes.CURRENT_USER_AVATAR_UPLOAD,
|
||||
export const updateCurrentUserAvatar = (data) => ({
|
||||
type: EntryActionTypes.CURRENT_USER_AVATAR_UPDATE,
|
||||
payload: {
|
||||
file,
|
||||
data,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ export * from './card';
|
||||
export * from './card-membership';
|
||||
export * from './card-label';
|
||||
export * from './task';
|
||||
export * from './attachment';
|
||||
export * from './actions';
|
||||
export * from './action';
|
||||
export * from './comment-action';
|
||||
|
||||
@@ -233,23 +233,23 @@ export const updateUserUsernameFailed = (id, error) => ({
|
||||
},
|
||||
});
|
||||
|
||||
export const uploadUserAvatarRequested = (id) => ({
|
||||
type: ActionTypes.USER_AVATAR_UPLOAD_REQUESTED,
|
||||
export const updateUserAvatarRequested = (id) => ({
|
||||
type: ActionTypes.USER_AVATAR_UPDATE_REQUESTED,
|
||||
payload: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
|
||||
export const uploadUserAvatarSucceeded = (id, avatar) => ({
|
||||
type: ActionTypes.USER_AVATAR_UPLOAD_SUCCEEDED,
|
||||
export const updateUserAvatarSucceeded = (id, avatarUrl) => ({
|
||||
type: ActionTypes.USER_AVATAR_UPDATE_SUCCEEDED,
|
||||
payload: {
|
||||
id,
|
||||
avatar,
|
||||
avatarUrl,
|
||||
},
|
||||
});
|
||||
|
||||
export const uploadUserAvatarFailed = (id, error) => ({
|
||||
type: ActionTypes.USER_AVATAR_UPLOAD_FAILED,
|
||||
export const updateUserAvatarFailed = (id, error) => ({
|
||||
type: ActionTypes.USER_AVATAR_UPDATE_FAILED,
|
||||
payload: {
|
||||
id,
|
||||
error,
|
||||
|
||||
Reference in New Issue
Block a user