diff options
author | Joas Schilling <coding@schilljs.com> | 2022-07-13 13:05:18 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-07-14 10:22:41 +0200 |
commit | ba9815fbe1abfaf87bab8453929dbfd9538d2d6c (patch) | |
tree | 85ad17635c8122a3d4b18d0eb32e51a46dae0e86 /apps/settings | |
parent | fc9a644bb54736721f14135be833f40bb8d6b124 (diff) | |
download | nextcloud-server-ba9815fbe1abfaf87bab8453929dbfd9538d2d6c.tar.gz nextcloud-server-ba9815fbe1abfaf87bab8453929dbfd9538d2d6c.zip |
Translate error when user already exists
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/settings')
-rw-r--r-- | apps/settings/src/store/index.js | 4 | ||||
-rw-r--r-- | apps/settings/src/store/users.js | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/apps/settings/src/store/index.js b/apps/settings/src/store/index.js index 9d8733d430e..6689e4e5546 100644 --- a/apps/settings/src/store/index.js +++ b/apps/settings/src/store/index.js @@ -37,9 +37,9 @@ const mutations = { API_FAILURE(state, error) { try { const message = error.error.response.data.ocs.meta.message - showError(t('settings', 'An error occured during the request. Unable to proceed.') + '<br>' + message, { isHTML: true }) + showError(t('settings', 'An error occurred during the request. Unable to proceed.') + '<br>' + message, { isHTML: true }) } catch (e) { - showError(t('settings', 'An error occured during the request. Unable to proceed.')) + showError(t('settings', 'An error occurred during the request. Unable to proceed.')) } console.error(state, error) }, diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js index ec15c8dd745..ce15fa4e87b 100644 --- a/apps/settings/src/store/users.js +++ b/apps/settings/src/store/users.js @@ -30,6 +30,7 @@ import api from './api' import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' import logger from '../logger' +import { showError } from '@nextcloud/dialogs' const orderGroups = function(groups, orderBy) { /* const SORT_USERCOUNT = 1; @@ -552,6 +553,13 @@ const actions = { .then((response) => dispatch('addUserData', userid || response.data.ocs.data.id)) .catch((error) => { throw error }) }).catch((error) => { + const statusCode = error?.response?.data?.ocs?.meta?.statuscode + + if (statusCode === 102) { + showError(t('settings', 'User already exists.')) + throw error + } + commit('API_FAILURE', { userid, error }) throw error }) |