Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-07-13 14:05:18 +0300
committerJoas Schilling <coding@schilljs.com>2022-07-14 11:22:41 +0300
commitba9815fbe1abfaf87bab8453929dbfd9538d2d6c (patch)
tree85ad17635c8122a3d4b18d0eb32e51a46dae0e86
parentfc9a644bb54736721f14135be833f40bb8d6b124 (diff)
Translate error when user already exists
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/settings/src/store/index.js4
-rw-r--r--apps/settings/src/store/users.js8
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
})