Skip to content

Commit 7fa192f

Browse files
committed
fix: update Header Text
1 parent e8676be commit 7fa192f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

public/index.html

+9-10
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,13 @@ <h4>Complete <span>(0)</span></h4>
8686

8787
await fetchTodos()
8888
}
89-
90-
function updateHeaderText() {
91-
const todosLength = todos.length
92-
const newString = todos.length === 1 ?
93-
`You have 1 open task.` :
94-
`You have ${todosLength} open tasks.`
95-
header.querySelector('h1').innerText = newString
96-
}
97-
89+
let count;
9890
function updateNavCount() {
9991
navElements.forEach(ele => {
10092
const btnText = ele.innerText.split(' ')[0]
10193

10294
// filter todos in here
103-
const count = todos.filter(val => {
95+
count = todos.filter(val => {
10496
if (btnText === 'All') {
10597
return true
10698
}
@@ -114,6 +106,13 @@ <h4>Complete <span>(0)</span></h4>
114106
})
115107
}
116108

109+
function updateHeaderText() {
110+
const todosLength = todos.length
111+
const newString = todos.length === 1 ?
112+
`You have 1 open task.` :
113+
`You have ${todosLength-count} open tasks.`
114+
header.querySelector('h1').innerText = newString
115+
}
117116
function changeTab(tab) {
118117
selectedTab = tab
119118
navElements.forEach(val => {

0 commit comments

Comments
 (0)