mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-14 03:43:50 +00:00
event API refract
using optimistic updates
This commit is contained in:
@@ -113,7 +113,7 @@ exports.eventsPatch = async (req, res) => {
|
||||
const newEvents = replaceAt(events, itemIndex, updatedEvent);
|
||||
|
||||
events = [...newEvents];
|
||||
res.sendStatus(200);
|
||||
res.send(updatedEvent);
|
||||
};
|
||||
|
||||
// Create controller for DELETE request to '/events/'
|
||||
@@ -128,8 +128,7 @@ exports.eventsDelete = async (req, res) => {
|
||||
if (itemIndex === -1) {
|
||||
res.sendStatus(400);
|
||||
return;
|
||||
}
|
||||
else if (itemIndex === 0) events.shift();
|
||||
} else if (itemIndex === 0) events.shift();
|
||||
else events.splice(itemIndex, 1);
|
||||
|
||||
// Update events
|
||||
|
||||
@@ -3,8 +3,8 @@ const event = {
|
||||
title: '',
|
||||
subtitle: '',
|
||||
presenter: '',
|
||||
timeStart: new Date(),
|
||||
timeEnd: new Date(),
|
||||
timeStart: null,
|
||||
timeEnd: null,
|
||||
clockStarted: null,
|
||||
type: 'event',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user