init
This commit is contained in:
parent
088f64eecc
commit
3f38cde71d
|
@ -57,9 +57,10 @@ export function mockXHR() {
|
||||||
// for mock server
|
// for mock server
|
||||||
const responseFake = (url, type, respond) => {
|
const responseFake = (url, type, respond) => {
|
||||||
return {
|
return {
|
||||||
url: new RegExp(`/mock${url}`),
|
url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
|
||||||
type: type || 'get',
|
type: type || 'get',
|
||||||
response(req, res) {
|
response(req, res) {
|
||||||
|
console.log('request invoke:' + req.path)
|
||||||
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
|
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,18 +36,7 @@ module.exports = {
|
||||||
warnings: false,
|
warnings: false,
|
||||||
errors: true
|
errors: true
|
||||||
},
|
},
|
||||||
proxy: {
|
before: require('./mock/mock-server.js')
|
||||||
// change xxx-api/login => mock/login
|
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
|
||||||
target: `http://127.0.0.1:${port}/mock`,
|
|
||||||
changeOrigin: true,
|
|
||||||
pathRewrite: {
|
|
||||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
after: require('./mock/mock-server.js')
|
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
// provide the app's title in webpack's name field, so that
|
// provide the app's title in webpack's name field, so that
|
||||||
|
|
Loading…
Reference in New Issue