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

Fix api transformers, intercept by error message instead of undefined

This commit is contained in:
Maksim Eltyshev 2019-10-25 21:38:14 +05:00
parent 8e0e819309
commit 4a6553d241
3 changed files with 23 additions and 11 deletions

View file

@ -4,11 +4,17 @@ import socket from './socket';
export const transformCard = (card) => ({
...card,
dueDate: card.dueDate && new Date(card.dueDate),
timer: card.timer && {
...card.timer,
startedAt: card.timer.startedAt && new Date(card.timer.startedAt),
},
...(card.dueDate && {
dueDate: new Date(card.dueDate),
}),
...(card.timer && {
timer: {
...card.timer,
...(card.timer.startedAt && {
startedAt: new Date(card.timer.startedAt),
}),
},
}),
});
export const transformCardData = (data) => ({
@ -17,10 +23,12 @@ export const transformCardData = (data) => ({
dueDate: data.dueDate.toISOString(),
}),
...(data.timer && {
...data.timer,
...(data.timer.startedAt && {
startedAt: data.timer.startedAt.toISOString(),
}),
timer: {
...data.timer,
...(data.timer.startedAt && {
startedAt: data.timer.startedAt.toISOString(),
}),
},
}),
});