client: add new-post error if no files are present
This commit is contained in:
parent
f20fa72b6d
commit
06fad98ee1
2 changed files with 14 additions and 5 deletions
|
@ -74,7 +74,14 @@ const Post = () => {
|
||||||
text: 'Please fill out the post title',
|
text: 'Please fill out the post title',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
setSubmitting(false)
|
hasErrored = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!docs.length) {
|
||||||
|
setToast({
|
||||||
|
text: 'Please add at least one document',
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
hasErrored = true
|
hasErrored = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +91,14 @@ const Post = () => {
|
||||||
text: 'Please fill out all the document titles',
|
text: 'Please fill out all the document titles',
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
setSubmitting(false)
|
|
||||||
hasErrored = true
|
hasErrored = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasErrored) return
|
if (hasErrored) {
|
||||||
|
setSubmitting(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
await sendRequest('/server-api/posts/create', {
|
await sendRequest('/server-api/posts/create', {
|
||||||
title,
|
title,
|
||||||
|
|
|
@ -12,9 +12,9 @@ export const sequelize = new Sequelize({
|
||||||
})
|
})
|
||||||
|
|
||||||
if (config.memory_db) {
|
if (config.memory_db) {
|
||||||
console.log(`Database path: ${databasePath}`)
|
|
||||||
} else {
|
|
||||||
console.log("Using in-memory database")
|
console.log("Using in-memory database")
|
||||||
|
} else {
|
||||||
|
console.log(`Database path: ${databasePath}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const umzug = new Umzug({
|
export const umzug = new Umzug({
|
||||||
|
|
Loading…
Reference in a new issue