diff --git a/src/Components/Home/Filter.js b/src/Components/Home/Filter.js index 184bb815..3549c555 100644 --- a/src/Components/Home/Filter.js +++ b/src/Components/Home/Filter.js @@ -19,7 +19,7 @@ export const Filter = props => { let alert; if (incompleteTasks.length === 0) { - alert = 'noAlert' + alert = 'filterButton' } else { alert = 'Alert' } diff --git a/src/Components/NewTask/NewTask.js b/src/Components/NewTask/NewTask.js index 04ff72c8..b22895e9 100644 --- a/src/Components/NewTask/NewTask.js +++ b/src/Components/NewTask/NewTask.js @@ -112,7 +112,7 @@ class NewTask extends React.Component { notificationId: notificationId }; - createTask(payload, id) + createTask(payload, id, categoryID) .then(() => { this.props.updateFilteredTask([]); this.props.timePeriod('Today'); @@ -135,7 +135,7 @@ class NewTask extends React.Component { notificationId: notificationId }; - createTask(payload, id) + createTask(payload, id, categoryID) .then(() => { this.props.updateFilteredTask([]); this.props.timePeriod('Today'); @@ -157,7 +157,7 @@ class NewTask extends React.Component { end_time, notificationId: notificationId }; - createTask(payload, id) + createTask(payload, id, categoryID) .then(() => { this.props.updateFilteredTask([]); this.props.timePeriod('Today'); diff --git a/src/Components/TaskList/index.js b/src/Components/TaskList/index.js index e0009c68..27dc3d12 100644 --- a/src/Components/TaskList/index.js +++ b/src/Components/TaskList/index.js @@ -37,7 +37,8 @@ class editTaskList extends React.Component { taskList: list }) } - itemArr = [] + + itemArr = []; check = item => { var task = item.id console.log(task) @@ -58,6 +59,7 @@ class editTaskList extends React.Component { this.classBTN(item) console.log(this.itemArr) } + classBTN = item => { console.log("hitting check") $("#containter") @@ -66,7 +68,7 @@ class editTaskList extends React.Component { } arrar = [] - complete = () => { + complete = async () => { for (var i = 0; i < this.itemArr.length; i++) { this.arrar.push(this.itemArr[i]) } @@ -75,7 +77,7 @@ class editTaskList extends React.Component { this.getTaskById(id) }) - setTimeout(() => { + await setTimeout(() => { window.location.reload(true) }, 500) } @@ -87,14 +89,11 @@ class editTaskList extends React.Component { this.tasksById.push(task) } }) - // console.log(this.tasksById) this.setState( { retrievedTasks: this.tasksById }, () => { - // console.log(this.state.retrievedTasks); - this.state.retrievedTasks.map(task => { const id = task.id const payload = { @@ -119,7 +118,7 @@ class editTaskList extends React.Component { }, setTimeout(() => { window.location.reload(true) - }, 100) + }, 500) ) } @@ -133,7 +132,6 @@ class editTaskList extends React.Component { return task.status === true }) - // render content to page render() { return (
diff --git a/src/actions.js b/src/actions.js index 1753cf9e..d8abc8a5 100644 --- a/src/actions.js +++ b/src/actions.js @@ -145,7 +145,7 @@ export function updateUser(payload, id) { } axios - .put(` https://get2itpt9.herokuapp.com/api/auth/edit-profile/${id}`, payload, { headers }) + .put(` https://get2itpt9.herokuapp.com/api/auth/users/${id}`, payload, { headers }) .then(res => { dispatch({ type: UPDATE_USER_SUCCESS, payload: payload, id: id }); }) @@ -170,7 +170,10 @@ export function createTask(payload, user_id, category_id) { dispatch({ type: CREATE_TASK_SUCCESS, payload: payload}); let task_id = res.data.id; console.log(task_id, user_id, category_id); - return axios.post(`https://get2itpt9.herokuapp.com/api/categories/${category_id}/tasks`, {task_id: task_id}, {headers}) + return axios.post(`https://get2itpt9.herokuapp.com/api/categories/${category_id}/tasks`, + {task_id: task_id}, + {headers} + ) }) .then(res => console.log(res)) .catch(err => {