feat: unify task and habit pages with Today
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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. */ })
|
||||
}
|
||||
Reference in New Issue
Block a user