♻️ Use a better method to not create a pointer

This commit is contained in:
2022-05-01 19:23:05 +02:00
parent a7d197752f
commit c733325cc9

View File

@ -10,7 +10,7 @@ const timetable = computed(() => {
const currentDay = parsedTimetable.value[timetableDay.value];
if (!currentDay) return [];
const newDay = currentDay.map((e, index) => {
const newElement = JSON.parse(JSON.stringify(e));
const newElement = { ...e };
newElement.substitution = substitutions.value.find((entry) => {
const entryDay = new Date(entry.date).getDay() - 1;
return entry.lesson == index + 1 && entryDay == timetableDay.value;