client: add new-post error if no files are present

This commit is contained in:
Max Leiter 2022-04-01 16:59:06 -07:00
parent f20fa72b6d
commit 06fad98ee1
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
2 changed files with 14 additions and 5 deletions

View file

@ -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,

View file

@ -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({