diff --git a/config/default.json b/config/default.json index 3efb3646..8befb78f 100644 --- a/config/default.json +++ b/config/default.json @@ -6,11 +6,13 @@ "adempiere": { "api": { "url": "http://localhost:8085", - "service": "/adempiere-api" + "service": "/adempiere-api", + "fullPath": "http://localhost:8085/adempiere-api" }, "images": { "url": "http://localhost:8085", - "service": "/adempiere-api" + "service": "/adempiere-api/img", + "fullPath": "http://localhost:8085/adempiere-api/img" } } } diff --git a/src/api/ADempiere/instances.js b/src/api/ADempiere/instances.js index 88ef5e73..480f57be 100644 --- a/src/api/ADempiere/instances.js +++ b/src/api/ADempiere/instances.js @@ -1,4 +1,4 @@ -import { getConfig } from '@/utils/ADempiere/config' +import { config } from '@/utils/ADempiere/config' /** * Instance for connection to API RESTful with axios * @author EdwinBetanc0urt @@ -25,8 +25,8 @@ export function ApiRest({ }) return request.interceptors } - var config = getConfig() - const apiRestAddress = config.adempiere.api.url + config.adempiere.api.service + + const apiRestAddress = config.adempiere.api.fullPath const axios = require('axios') const request = axios.create({ baseURL: apiRestAddress, diff --git a/src/utils/ADempiere/config.js b/src/utils/ADempiere/config.js index db31f2a8..f1f7c3a8 100644 --- a/src/utils/ADempiere/config.js +++ b/src/utils/ADempiere/config.js @@ -1,5 +1,2 @@ // Get Config based on default or local -export function getConfig() { - const config = require('../../../config/default.json') - return config -} +export const config = require('../../../config/default.json') diff --git a/src/utils/ADempiere/resource.js b/src/utils/ADempiere/resource.js index db556632..ca51d580 100644 --- a/src/utils/ADempiere/resource.js +++ b/src/utils/ADempiere/resource.js @@ -1,7 +1,8 @@ // This file allows generate util functions for handle arrays, resources and all // related to upload to server side and downdload from server side to client side. // Please add the necessary functions here: -import { getConfig } from '@/utils/ADempiere/config' +import { config } from '@/utils/ADempiere/config' + // Merge two arrays and return merged array export function mergeByteArray(currentArray, arrayToMerge) { const mergedArray = new currentArray.constructor(currentArray.length + arrayToMerge.length) @@ -58,9 +59,8 @@ export function getImagePath({ height = 300, operation = 'fit' }) { - var config = getConfig() - const url = config.adempiere.images.url + config.adempiere.images.service - const urn = `/img?action=${operation}&width=${width}&height=${height}&url=${file}` + const url = config.adempiere.images.fullPath + const urn = `/?action=${operation}&width=${width}&height=${height}&url=${file}` const uri = `${url}${urn}` return {