summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS.md1
-rw-r--r--src/components/AppNavigation/RootNavigation.vue10
-rw-r--r--src/store/groups.js3
3 files changed, 11 insertions, 3 deletions
diff --git a/AUTHORS.md b/AUTHORS.md
index acf0a4bb..edc560bf 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -9,6 +9,7 @@
- Christian Kraus <hanzi@hanzi.cc>
- Christoph Wurst <christoph@winzerhof-wurst.at>
- Daniel Kesselberg <mail@danielkesselberg.de>
+- Dominik Kuzila <kuziladominik@gmail.com>
- Gary Kim <gary@garykim.dev>
- Georg Ehrke <oc.list@georgehrke.com>
- Greta Doci <gretadoci@gmail.com>
diff --git a/src/components/AppNavigation/RootNavigation.vue b/src/components/AppNavigation/RootNavigation.vue
index 627fa9ff..c92d9c42 100644
--- a/src/components/AppNavigation/RootNavigation.vue
+++ b/src/components/AppNavigation/RootNavigation.vue
@@ -393,10 +393,14 @@ export default {
this.createGroupError = null
this.logger.debug('Created new local group', { groupName })
- this.$store.dispatch('addGroup', groupName)
- this.isNewGroupMenuOpen = false
- emit('contacts:group:append', groupName)
+ try {
+ this.$store.dispatch('addGroup', groupName)
+ this.isNewGroupMenuOpen = false
+ emit('contacts:group:append', groupName)
+ } catch (error) {
+ showError(t('contacts', 'An error occurred while creating the group'))
+ }
},
// Ellipsis item toggles
diff --git a/src/store/groups.js b/src/store/groups.js
index 4da839e2..44de3e21 100644
--- a/src/store/groups.js
+++ b/src/store/groups.js
@@ -184,6 +184,9 @@ const actions = {
* @param {string} groupName the name of the group
*/
addGroup(context, groupName) {
+ if (!groupName || groupName.trim() === '') {
+ throw new Error('Group name cannot be empty')
+ }
context.commit('addGroup', groupName)
},
}