add variable api

This commit is contained in:
vincent 2019-04-24 18:13:46 +02:00
parent 80ce05b35d
commit 0842cfc3d1
4 changed files with 10 additions and 18 deletions

View File

@ -3,6 +3,7 @@ const merge = require('webpack-merge')
const prodEnv = require('./prod.env') const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, { module.exports = merge(prodEnv, {
NODE_ENV: '"development"' NODE_ENV: '"development"',
ROOT_API:'"http://localhost:5000"',
}) })

View File

@ -10,13 +10,7 @@ module.exports = {
// Paths // Paths
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '/', assetsPublicPath: '/',
proxyTable: {
'/api/v1/chaine': {
target: 'http://localhost:5000',
changOrigin: true
}
},
// Various Dev Server settings // Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
@ -56,12 +50,7 @@ module.exports = {
assetsRoot: path.resolve(__dirname, '../../backend/dist'), assetsRoot: path.resolve(__dirname, '../../backend/dist'),
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '/chainetv/', assetsPublicPath: '/chainetv/',
proxyTable: {
'/api/v1/chaine': {
target: 'chainetv/api/v1/chaine',
changOrigin: false
}
},
/** /**
* Source Maps * Source Maps

View File

@ -1,4 +1,5 @@
'use strict' 'use strict'
module.exports = { module.exports = {
NODE_ENV: '"production"' NODE_ENV: '"production"',
ROOT_API:'/chainetv'
} }

View File

@ -32,7 +32,8 @@ export default {
}, },
methods: { methods: {
getchaine(num) { getchaine(num) {
let path = '/api/v1/chaine/';
let path = process.env.ROOT_API + '/api/v1/chaine/';
path += num; path += num;
axios.get(path) axios.get(path)
.then((res) => { .then((res) => {
@ -49,7 +50,7 @@ export default {
}, },
parsechaine() { parsechaine() {
const path = '/api/v1/chaine/'; const path = process.env.ROOT_API + '/api/v1/chaine/';
axios.put(path) axios.put(path)
.then((res) => { .then((res) => {
this.message = res.data; this.message = res.data;