mirror of
https://github.com/plankanban/planka.git
synced 2025-07-24 23:59:48 +02:00
parent
2c84316fe0
commit
934dcdf39b
22 changed files with 419 additions and 18 deletions
|
@ -1,4 +1,5 @@
|
|||
import socket from './socket';
|
||||
import { transformCard } from './cards';
|
||||
|
||||
/* Actions */
|
||||
|
||||
|
@ -7,10 +8,33 @@ const createList = (boardId, data, headers) =>
|
|||
|
||||
const updateList = (id, data, headers) => socket.patch(`/lists/${id}`, data, headers);
|
||||
|
||||
const sortList = (id, data, headers) =>
|
||||
socket.post(`/lists/${id}/sort`, data, headers).then((body) => ({
|
||||
...body,
|
||||
included: {
|
||||
...body.included,
|
||||
cards: body.included.cards.map(transformCard),
|
||||
},
|
||||
}));
|
||||
|
||||
const deleteList = (id, headers) => socket.delete(`/lists/${id}`, undefined, headers);
|
||||
|
||||
/* Event handlers */
|
||||
|
||||
const makeHandleListSort = (next) => (body) => {
|
||||
next({
|
||||
...body,
|
||||
included: {
|
||||
...body.included,
|
||||
cards: body.included.cards.map(transformCard),
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export default {
|
||||
createList,
|
||||
updateList,
|
||||
sortList,
|
||||
deleteList,
|
||||
makeHandleListSort,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue