File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -86,21 +86,13 @@ <h4>Complete <span>(0)</span></h4>
86
86
87
87
await fetchTodos ( )
88
88
}
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 ;
98
90
function updateNavCount ( ) {
99
91
navElements . forEach ( ele => {
100
92
const btnText = ele . innerText . split ( ' ' ) [ 0 ]
101
93
102
94
// filter todos in here
103
- const count = todos . filter ( val => {
95
+ count = todos . filter ( val => {
104
96
if ( btnText === 'All' ) {
105
97
return true
106
98
}
@@ -114,6 +106,13 @@ <h4>Complete <span>(0)</span></h4>
114
106
} )
115
107
}
116
108
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
+ }
117
116
function changeTab ( tab ) {
118
117
selectedTab = tab
119
118
navElements . forEach ( val => {
You can’t perform that action at this time.
0 commit comments