don't allow createProject with empty name
This commit is contained in:
parent
13bade9e81
commit
278be8c120
@ -3,6 +3,10 @@ const API = process.env.REACT_APP_API || 'http://localhost:1337'
|
|||||||
|
|
||||||
export async function createProject(e) {
|
export async function createProject(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
if (this.state.newProject === '') {
|
||||||
|
alert('What about a project name?')
|
||||||
|
return
|
||||||
|
}
|
||||||
const project = { name: this.state.newProject }
|
const project = { name: this.state.newProject }
|
||||||
try {
|
try {
|
||||||
const { data, error } = await axios.post(API + '/api/projects', project)
|
const { data, error } = await axios.post(API + '/api/projects', project)
|
||||||
|
Loading…
Reference in New Issue
Block a user