Skip to content

Commit f8653d7

Browse files
committed
add condition to fetch all task irrespective of status
1 parent 45bffdf commit f8653d7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

controllers/tasks.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ const fetchTasks = async (req, res) => {
5252
*/
5353
const getUserTasks = async (req, res) => {
5454
try {
55-
const statuses = req.query.status
55+
const status = req.query.status
5656
const { username } = req.params
5757
let allTasks = []
5858

59-
if (statuses) {
60-
allTasks = await tasks.fetchUserTasks(username, statuses.split(','))
59+
if (status) {
60+
allTasks = await tasks.fetchUserTasks(username, status)
61+
} else {
62+
allTasks = await tasks.fetchUserTasks(username)
6163
}
6264

6365
if (allTasks.userNotFound) {

0 commit comments

Comments
 (0)