feat: make additional data object
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-11-13 17:29:19 +01:00
parent 34df9cf254
commit a5d032f022
1 changed files with 18 additions and 10 deletions

View File

@ -5,12 +5,10 @@ import qFormMixin from './qformMixin';
import keyShortcut from './keyShortcut';
import { i18n } from './i18n';
import useNotify from 'src/composables/useNotify.js';
import { useStateQueryStore } from 'src/stores/useStateQueryStore';
import VnInput from 'src/components/common/VnInput.vue';
import { useVnConfirm } from 'src/composables/useVnConfirm';
const { notify } = useNotify();
const stateQuery = useStateQueryStore();
const { openConfirmationModal } = useVnConfirm();
export default boot(({ app }) => {
@ -53,13 +51,25 @@ export default boot(({ app }) => {
message = 'Duplicate request';
}
const { config, headers, request, status, statusText, data } = response || {};
const { params, url, method, signal, headers: confHeaders } = config || {};
const { message: resMessage, code, name } = data?.error || {};
const additionalData = {
frontPath: '',
backError: {
config: error.config,
data: error,
path: location.href,
message: resMessage,
code,
request: request?.responseURL,
status,
name,
statusText: statusText,
config: {
url,
method,
params,
headers: confHeaders,
aborted: signal.aborted,
version: headers?.['salix-version'],
},
httpRequest: error.request.response,
};
const opts = {
actions: [
@ -72,9 +82,7 @@ export default boot(({ app }) => {
handler: async () => {
const locale = i18n.global.t;
const reason = ref(
response.data.error.code == 'ACCESS_DENIED'
? locale('cau.askPrivileges')
: ''
code == 'ACCESS_DENIED' ? locale('cau.askPrivileges') : ''
);
openConfirmationModal(
locale('cau.title'),