don't allow createProject with empty name
This commit is contained in:
parent
278be8c120
commit
19eb55fd60
@ -25,13 +25,15 @@ const TaskRow = props => {
|
||||
</button>
|
||||
{props.component === 'project' ? (
|
||||
''
|
||||
) : (
|
||||
) : task.projectId ? (
|
||||
<button
|
||||
className="btn ml-3 mr-2 float-right"
|
||||
onClick={() => props.selectProject(task.projectId)}
|
||||
>
|
||||
{project.name}
|
||||
</button>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
|
@ -7,30 +7,16 @@ export async function createTask(e) {
|
||||
alert("Why don't you enter a name for this task?")
|
||||
return
|
||||
}
|
||||
{
|
||||
/*if (!this.state.selectedProjectId) {
|
||||
alert('No project selected, silly!')
|
||||
return
|
||||
}*/
|
||||
}
|
||||
|
||||
const newTask = {
|
||||
desc: this.state.newTask,
|
||||
projectId: this.state.selectedProjectId,
|
||||
// TODO
|
||||
// the backend expects projectName because it creates the project on the fly if none exists with that name
|
||||
// this feature comes at the price that there can't be two independent projects with the same name
|
||||
// which could be handy if users want to have private projects
|
||||
}
|
||||
if (newTask.desc === '') {
|
||||
alert('Task description is empty.')
|
||||
return
|
||||
}
|
||||
{
|
||||
/*} else if (!newTask.projectName) {
|
||||
alert('Select a project for new task.')
|
||||
return
|
||||
}*/
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('Adding task: ', newTask)
|
||||
const { data, error } = await axios.post(API + '/api/tasks', newTask)
|
||||
|
Loading…
Reference in New Issue
Block a user