fix for tasks being undefined when none were loaded
This commit is contained in:
parent
4bf8a5d2ff
commit
ea94fab0a5
1 changed files with 8 additions and 5 deletions
|
|
@ -154,15 +154,18 @@ export default function TaskViewer(props: ViewProps) {
|
||||||
taskAPI
|
taskAPI
|
||||||
.listTasks(50, 0, "asc", "start", undefined, undefined, as, prevMonth, nextMonth)
|
.listTasks(50, 0, "asc", "start", undefined, undefined, as, prevMonth, nextMonth)
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
resp.data.tasks.forEach(task => {
|
if(resp.data.tasks){
|
||||||
if (task.settings) {
|
resp.data.tasks.forEach(task => {
|
||||||
temp.set(task.key, Task.any(task));
|
if (task.settings) {
|
||||||
}
|
temp.set(task.key, Task.any(task));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
setTasks(temp);
|
setTasks(temp);
|
||||||
setLoaded(true);
|
setLoaded(true);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
openSnack("Failed to load tasks");
|
openSnack("Failed to load tasks");
|
||||||
});
|
});
|
||||||
}, [taskAPI, as, user, openSnack, nextMonth, prevMonth]);
|
}, [taskAPI, as, user, openSnack, nextMonth, prevMonth]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue