Merge pull request #33262 from nextcloud/backport/33222/stable24

[stable24] Translate error when user already exists
This commit is contained in:
Vincent Petry 2022-07-20 12:36:07 +02:00 committed by GitHub
commit 08dabe975e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View file

@ -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)
},

View file

@ -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
})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long