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:
AmbrishRamachandiran
2023-07-27 12:02:13 +05:30
parent ceee1c3ca2
commit b0d9047894
2 changed files with 2 additions and 6 deletions
+1 -3
View File
@@ -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 {
+1 -3
View File
@@ -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,