Show open Vikunja task count as badge on To-Do sidebar link
Fetched async via /api/todos/count so it doesn't block page render. Badge hidden when count is zero. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,12 @@ from app.vikunja import create_task, delete_task, get_tasks, update_task
|
||||
router = APIRouter(prefix="/todos", tags=["todos"])
|
||||
|
||||
|
||||
@router.get("/count")
|
||||
def count_todos():
|
||||
tasks = get_tasks()
|
||||
return {"open": sum(1 for t in tasks if not t.get("done"))}
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def list_todos():
|
||||
return get_tasks()
|
||||
|
||||
Reference in New Issue
Block a user