diff options
author | Joas Schilling <coding@schilljs.com> | 2022-07-13 14:05:18 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-07-18 16:26:21 +0300 |
commit | 4f0862c431919c319218117f4f6618adede08b18 (patch) | |
tree | f23769d7c9f2a93a645fdb6c440f5154b291123d /apps | |
parent | 7844c0bce1f8a5b495c86c7a09bcd862ed06d90a (diff) |
Translate error when user already exists
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-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 }) |