Limit the use of the same shortcut name when adding a shortcut
Signed-off-by: AmbrishRamachandiran <ambrish.r@infosys.com>
This commit is contained in:
@@ -64,9 +64,7 @@ export const AddShortcut = ({
|
||||
const shortcutData = api.get();
|
||||
|
||||
const handleSave: SubmitHandler<FormValues> = async ({ url, title }) => {
|
||||
if (!api.get().some(shortcutTitle => shortcutTitle.title === title)) {
|
||||
analytics.captureEvent('click', `Clicked 'Save' in AddShortcut`);
|
||||
}
|
||||
analytics.captureEvent('click', `Clicked 'Save' in AddShortcut`);
|
||||
const shortcut: Omit<Shortcut, 'id'> = { url, title };
|
||||
|
||||
try {
|
||||
|
||||
@@ -63,9 +63,7 @@ export const EditShortcut = ({
|
||||
const shortcutData = api.get();
|
||||
|
||||
const handleSave: SubmitHandler<FormValues> = async ({ url, title }) => {
|
||||
if (!api.get().some(shortcutTitle => shortcutTitle.title === title)) {
|
||||
analytics.captureEvent('click', `Clicked 'Save' in Edit Shortcut`);
|
||||
}
|
||||
analytics.captureEvent('click', `Clicked 'Save' in Edit Shortcut`);
|
||||
const newShortcut: Shortcut = {
|
||||
...shortcut,
|
||||
url,
|
||||
|
||||
Reference in New Issue
Block a user