Files
planka/client/src/actions/lists.js

100 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-08-31 04:07:25 +05:00
import ActionTypes from '../constants/ActionTypes';
2022-08-04 13:31:14 +02:00
const createList = (list) => ({
2019-08-31 04:07:25 +05:00
type: ActionTypes.LIST_CREATE,
payload: {
list,
},
});
createList.success = (localId, list) => ({
type: ActionTypes.LIST_CREATE__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
localId,
list,
},
});
createList.failure = (localId, error) => ({
type: ActionTypes.LIST_CREATE__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
localId,
error,
},
});
2022-08-04 13:31:14 +02:00
const handleListCreate = (list) => ({
type: ActionTypes.LIST_CREATE_HANDLE,
2019-08-31 04:07:25 +05:00
payload: {
list,
},
});
2022-08-04 13:31:14 +02:00
const updateList = (id, data) => ({
type: ActionTypes.LIST_UPDATE,
2019-08-31 04:07:25 +05:00
payload: {
id,
data,
},
});
updateList.success = (list) => ({
type: ActionTypes.LIST_UPDATE__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
list,
},
});
updateList.failure = (id, error) => ({
type: ActionTypes.LIST_UPDATE__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
id,
error,
},
});
2022-08-04 13:31:14 +02:00
const handleListUpdate = (list) => ({
type: ActionTypes.LIST_UPDATE_HANDLE,
2019-08-31 04:07:25 +05:00
payload: {
list,
},
});
2022-08-04 13:31:14 +02:00
const deleteList = (id) => ({
type: ActionTypes.LIST_DELETE,
2019-08-31 04:07:25 +05:00
payload: {
id,
},
});
deleteList.success = (list) => ({
type: ActionTypes.LIST_DELETE__SUCCESS,
2019-08-31 04:07:25 +05:00
payload: {
list,
},
});
deleteList.failure = (id, error) => ({
type: ActionTypes.LIST_DELETE__FAILURE,
2019-08-31 04:07:25 +05:00
payload: {
id,
error,
},
});
2022-08-04 13:31:14 +02:00
const handleListDelete = (list) => ({
type: ActionTypes.LIST_DELETE_HANDLE,
2019-08-31 04:07:25 +05:00
payload: {
list,
},
});
2022-08-04 13:31:14 +02:00
export default {
createList,
handleListCreate,
updateList,
handleListUpdate,
deleteList,
handleListDelete,
};