ui fix for shift UI
This commit is contained in:
@ -81,13 +81,10 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
|
||||
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
||||
// Update the 'publisher' property of the returned data with the full publisher object
|
||||
data.publisher = publisher;
|
||||
//ToDo: see if we need to update in state
|
||||
// publisher.currentWeekAssignments += 1;
|
||||
// publisher.currentMonthAssignments += 1;
|
||||
setAssignments(prevAssignments => [...prevAssignments, data]);
|
||||
if (onAssignmentChange) {
|
||||
onAssignmentChange(data.publisher.id, 'add')
|
||||
}
|
||||
setAssignments(prevAssignments => [...prevAssignments, data]);
|
||||
} catch (error) {
|
||||
console.error("Error adding assignment:", error);
|
||||
}
|
||||
|
@ -367,6 +367,8 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
||||
// Update the 'publisher' property of the returned data with the full publisher object
|
||||
data.publisher = publisher;
|
||||
data.shift = shifts.find(shift => shift.id === shiftId);
|
||||
publisher.assignments = [...publisher.assignments, data];
|
||||
handleAssignmentChange(publisher.id, 'add');
|
||||
} catch (error) {
|
||||
console.error("Error adding assignment:", error);
|
||||
|
Reference in New Issue
Block a user