Translate error when user already exists

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/33222/head
Joas Schilling 2022-07-13 13:05:18 +07:00
parent fc9a644bb5
commit ba9815fbe1
No known key found for this signature in database
GPG Key ID: C2384F28E6F59A23
2 changed files with 10 additions and 2 deletions

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

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