Make all stores refresh on change

Since everything is calculated on db.......
This commit is contained in:
2024-06-15 14:08:34 +02:00
parent e81ead8e41
commit dafff6d064
15 changed files with 92 additions and 48 deletions

View File

@@ -2,6 +2,16 @@ import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
import { cubicOut } from 'svelte/easing'
import type { TransitionConfig } from 'svelte/transition'
import { dailyFoodStore } from '$lib/store/energy/dailyFoodStore'
import { foodStore } from '$lib/store/energy/foodStore'
import { weeklyFoodStore } from '$lib/store/energy/weeklyFoodStore'
import { monthlyFoodStore } from '$lib/store/energy/monthlyFoodStore'
import { yearlyFoodStore } from '$lib/store/energy/yearlyFoodStore'
import { weightStore } from '$lib/store/weight/weightStore'
import { dailyWeightStore } from '$lib/store/weight/dailyWeightStore'
import { weeklyWeightStore } from '$lib/store/weight/weeklyWeightStore'
import { monthlyWeightStore } from '$lib/store/weight/monthlyWeightStore'
import { yearlyWeightStore } from '$lib/store/weight/yearlyWeightStore'
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
@@ -110,3 +120,27 @@ function GenerateColor(): string {
}
export { GenerateColor }
export function RefreshStores() {
// @ts-ignore
foodStore.refresh()
// @ts-ignore
dailyFoodStore.refresh()
// @ts-ignore
weeklyFoodStore.refresh()
// @ts-ignore
monthlyFoodStore.refresh()
// @ts-ignore
yearlyFoodStore.refresh()
// @ts-ignore
weightStore.refresh()
// @ts-ignore
dailyWeightStore.refresh()
// @ts-ignore
weeklyWeightStore.refresh()
// @ts-ignore
monthlyWeightStore.refresh()
// @ts-ignore
yearlyWeightStore.refresh()
}