mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
feat: Change api config from function to constant. (#544)
Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
486afc8aa7
commit
273b10141f
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 <EdwinBetanc0urt@oulook.com>
|
||||
@ -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,
|
||||
|
@ -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')
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user