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-26 09:48:50 +05:30
parent ee52a48b63
commit 5d99ca9350
+6 -13
View File
@@ -70,19 +70,12 @@ export const EditShortcut = ({
};
try {
if (api.get().some(shortcutTitle => shortcutTitle.title === title)) {
alertApi.post({
message: `Shortcut title already exist`,
severity: 'error',
});
} else {
await api.update(newShortcut);
alertApi.post({
message: `Updated shortcut '${title}'`,
severity: 'success',
display: 'transient',
});
}
await api.update(newShortcut);
alertApi.post({
message: `Updated shortcut '${title}'`,
severity: 'success',
display: 'transient',
});
} catch (error) {
alertApi.post({
message: `Could not update shortcut: ${error.message}`,