What the fuck just happened
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
watch(selectedDays, (newValue) => {
|
watch(selectedDays, (newValue) => {
|
||||||
let dates = Array.from(selectedDays.value.values())
|
let dates = Array.from(newValue.values())
|
||||||
datePicker.update(dates);
|
datePicker.update(dates);
|
||||||
}, { deep: true });
|
}, { deep: true });
|
||||||
|
|
||||||
@@ -26,19 +26,6 @@
|
|||||||
calendar.setDay(day);
|
calendar.setDay(day);
|
||||||
toggleSelectedDay(event.target.id, calendar.getDate());
|
toggleSelectedDay(event.target.id, calendar.getDate());
|
||||||
highlightSelectedDay(event.target);
|
highlightSelectedDay(event.target);
|
||||||
checkConsistency();
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkConsistency(){
|
|
||||||
|
|
||||||
let selected = selectedDays.value;
|
|
||||||
let stored = datePicker.value;
|
|
||||||
|
|
||||||
if(selected.size != stored.length){
|
|
||||||
datePicker.clear();
|
|
||||||
selected.clear();
|
|
||||||
router.push('/error')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleSelectedDay(id : string, date : Date) : void {
|
function toggleSelectedDay(id : string, date : Date) : void {
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ export const datePickerStore = defineStore('datePicker', {
|
|||||||
value: (state) : TimeStamp[] => state.dates as TimeStamp[],
|
value: (state) : TimeStamp[] => state.dates as TimeStamp[],
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
getValue(){
|
||||||
|
return this.dates;
|
||||||
|
},
|
||||||
update(dates : Date[]) : void {
|
update(dates : Date[]) : void {
|
||||||
this.dates = dates.map(date => new TimeStamp(date));
|
this.dates = dates.map(date => new TimeStamp(date));
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user