generated from dave/wails-template
Rework "nowStore" to scrollingTimeFrameStore that contains both from and to dates
This commit is contained in:
@@ -2,13 +2,11 @@ import { get, type Writable, writable } from "svelte/store";
|
||||
import { GetPaymentsForMonth } from "$wails/main/App";
|
||||
import { main } from "$wails/models";
|
||||
import { toast } from "svelte-sonner";
|
||||
import { nowStore } from "$lib/store/nowStore";
|
||||
import { scrollingTimeFrameStore } from "$lib/store/scrollingTimeFrameStore";
|
||||
|
||||
async function createStore(): Promise<Writable<main.Payment[]>> {
|
||||
const payments: main.Payment[] = [];
|
||||
const now = new Date();
|
||||
now.setMonth(get(nowStore).getMonth() - 1)
|
||||
const res = await GetPaymentsForMonth(now);
|
||||
const res = await GetPaymentsForMonth(get(scrollingTimeFrameStore).from);
|
||||
if (!res.success) {
|
||||
toast.error("Error getting payments " + res.error);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user