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:
@@ -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}`,
|
||||
|
||||
Reference in New Issue
Block a user