fixed meal plan data loading

This commit is contained in:
vabene1111
2025-09-04 20:51:54 +02:00
parent 22dfb2a410
commit 1618f8df79
2 changed files with 3 additions and 2 deletions

View File

@@ -131,9 +131,9 @@ function refreshVisiblePeriod(startDateUnknown: boolean) {
// load backwards to as on initial
if (startDateUnknown) {
useMealPlanStore().refreshFromAPI(DateTime.fromJSDate(calendarDate.value).minus({days: days}).toJSDate(), DateTime.now().plus({days: days}).toJSDate())
useMealPlanStore().refreshFromAPI(DateTime.fromJSDate(calendarDate.value).minus({days: days}).toJSDate(), DateTime.fromJSDate(calendarDate.value).plus({days: days}).toJSDate())
} else {
useMealPlanStore().refreshFromAPI(calendarDate.value, DateTime.now().plus({days: days}).toJSDate())
useMealPlanStore().refreshFromAPI(calendarDate.value, DateTime.fromJSDate(calendarDate.value).plus({days: days}).toJSDate())
}
}

View File

@@ -51,6 +51,7 @@ export const useMealPlanStore = defineStore(_STORE_ID, () => {
function refreshFromAPI(from_date: Date, to_date: Date) {
console.log('refresh from api', from_date, to_date)
if (currently_updating.value[0] !== from_date || currently_updating.value[1] !== to_date) {
currently_updating.value = [from_date, to_date] // certainly no perfect check but better than nothing
loading.value = true