Files
dodo/frontend/src/lib/task-open-total.ts
T
bboysoul 978c4b87ed
ci / gitleaks (push) Successful in 8s
ci / docker (push) Successful in 6m49s
feat: unify task and habit pages with Today
2026-09-18 10:51:57 +08:00

14 lines
406 B
TypeScript

type OpenTotalPayload = { total?: number; items?: unknown[] }
export function loadTaskOpenTotal(
request: () => Promise<OpenTotalPayload>,
isCurrent: () => boolean,
commit: (value: number) => void,
) {
void request()
.then((data) => {
if (isCurrent()) commit(Number(data.total ?? data.items?.length ?? 0))
})
.catch(() => { /* Summary failure is intentionally non-fatal. */ })
}