diff --git a/tasker-client/src/app/components/ModalNewTask/index.tsx b/tasker-client/src/app/components/ModalNewTask/index.tsx index 6ce89d5..9748383 100644 --- a/tasker-client/src/app/components/ModalNewTask/index.tsx +++ b/tasker-client/src/app/components/ModalNewTask/index.tsx @@ -23,7 +23,14 @@ const ModalNewTask = ({ isOpen, onClose, id = null }: Props) => { const [projectId, setProjectId] = useState(""); const handleSubmit = async () => { - if (!title || !authorUserId || !(id !== null || projectId)) return; + console.log(title, authorUserId, id, projectId); + + console.log("Creating task 1.."); + if ( + !(title && authorUserId && assignedUserId && (id !== null || projectId)) + ) + return; + console.log("Creating task 2..."); const formattedStartDate = formatISO(new Date(startDate), { representation: "complete", @@ -40,14 +47,17 @@ const ModalNewTask = ({ isOpen, onClose, id = null }: Props) => { tags, startDate: formattedStartDate, dueDate: formattedDueDate, - authorUserId: parseInt(authorUserId), - assignedUserId: parseInt(assignedUserId), - projectId: id !== null ? Number(id) : Number(projectId), + authorUserId: authorUserId, + assignedUserId: assignedUserId, + projectId: id !== null ? id : projectId, }); }; const isFormValid = () => { - return title && authorUserId && !(id !== null || projectId); + console.log(title, authorUserId, id, projectId); + return ( + title && authorUserId && assignedUserId && (id !== null || projectId) + ); }; const selectStyles = @@ -87,7 +97,7 @@ const ModalNewTask = ({ isOpen, onClose, id = null }: Props) => { } > - + diff --git a/tasker-client/src/app/components/Sidebar/index.tsx b/tasker-client/src/app/components/Sidebar/index.tsx index 419cf34..928b23b 100644 --- a/tasker-client/src/app/components/Sidebar/index.tsx +++ b/tasker-client/src/app/components/Sidebar/index.tsx @@ -93,7 +93,6 @@ const Sidebar = () => {