mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
Show error if name of new item cannot be determined
This commit is contained in:
parent
8965988504
commit
f3041f0bbb
@ -53,6 +53,13 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
})
|
||||
formItem.position = { type: 'Point', coordinates: [props.position.lng, props.position.lat] }
|
||||
evt.preventDefault()
|
||||
|
||||
const name = formItem.name ? formItem.name : user?.first_name
|
||||
if (!name) {
|
||||
toast.error('Name is must be defined')
|
||||
return
|
||||
}
|
||||
|
||||
setSpinner(true)
|
||||
|
||||
formItem.text &&
|
||||
@ -98,8 +105,8 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
;(!props.layer.userProfileLayer || !item) &&
|
||||
(await props.layer.api?.createItem!({
|
||||
...formItem,
|
||||
name,
|
||||
id: uuid,
|
||||
name: formItem.name ? formItem.name : user?.first_name,
|
||||
}))
|
||||
success = true
|
||||
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user