mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 01:13:11 +08:00
Fixed bug where user could create empty app or bookmark which was causing page to go blank
This commit is contained in:
@@ -69,6 +69,17 @@ export const BookmarksForm = ({
|
||||
const formSubmitHandler = (e: FormEvent): void => {
|
||||
e.preventDefault();
|
||||
|
||||
for (let field of ['name', 'url', 'icon'] as const) {
|
||||
if (/^ +$/.test(formData[field])) {
|
||||
createNotification({
|
||||
title: 'Error',
|
||||
message: `Field cannot be empty: ${field}`,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const createFormData = (): FormData => {
|
||||
const data = new FormData();
|
||||
if (customIcon) {
|
||||
|
||||
Reference in New Issue
Block a user