generated from dave/wails-template
Refresh payment stores on time frame change
This commit is contained in:
@@ -21,4 +21,14 @@ async function createStore(): Promise<Writable<main.Payment[]>> {
|
||||
};
|
||||
}
|
||||
|
||||
export const lastMonthPaymentsStore = await createStore();
|
||||
const lastMonthPaymentsStore = await createStore();
|
||||
scrollingTimeFrameStore.subscribe(async (timeframe) => {
|
||||
const res = await GetPaymentsForMonth(timeframe.from);
|
||||
if (!res.success) {
|
||||
toast.error("Error getting payments " + res.error);
|
||||
return;
|
||||
}
|
||||
lastMonthPaymentsStore.set(res.data);
|
||||
});
|
||||
|
||||
export { lastMonthPaymentsStore };
|
||||
|
@@ -21,4 +21,14 @@ async function createStore(): Promise<Writable<main.Payment[]>> {
|
||||
};
|
||||
}
|
||||
|
||||
export const thisMonthPaymentsStore = await createStore();
|
||||
const thisMonthPaymentsStore = await createStore();
|
||||
scrollingTimeFrameStore.subscribe(async (timeframe) => {
|
||||
const res = await GetPaymentsForMonth(timeframe.to);
|
||||
if (!res.success) {
|
||||
toast.error("Error getting payments " + res.error);
|
||||
return;
|
||||
}
|
||||
thisMonthPaymentsStore.set(res.data);
|
||||
});
|
||||
|
||||
export { thisMonthPaymentsStore };
|
||||
|
Reference in New Issue
Block a user