Fix duplicated code in todo.js