Skip to content

Commit

Permalink
Restrict item name length
Browse files Browse the repository at this point in the history
  • Loading branch information
abhaykumarvats committed Jan 7, 2023
1 parent 6a2eff0 commit eb5975b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/AddEditQ.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
const handleItemAdd = () => {
if (!newItemValue) return;
if (newItemValue.length > 10) {
error = "item name must be less than 10 characters";
if (newItemValue.length > 5) {
error = "item name must be less than 5 characters";
return;
}
Expand Down Expand Up @@ -119,8 +119,9 @@
};
const handleItemEdit = (id: string, value: string) => {
const newValue = window && window.prompt(`Edit Item Name`, value);
if (!newValue) return;
const newValue =
window && window.prompt(`Edit Item Name (Max 5 Characters)`, value);
if (!newValue || newValue.length > 5) return;
items = items.map((item) => {
if (item.id === id) return { ...item, value: newValue };
Expand Down

1 comment on commit eb5975b

@vercel
Copy link

@vercel vercel bot commented on eb5975b Jan 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

fifo – ./

simplyfifo.vercel.app
fifo-git-master-abhayvats.vercel.app
fifo-abhayvats.vercel.app

Please sign in to comment.