fix: fixed mock server (#541)

This commit is contained in:
花裤衩
2020-01-09 20:53:06 +08:00
committed by GitHub
parent 227ca9b649
commit 95c7bf5d10
6 changed files with 11 additions and 21 deletions

View File

@@ -53,9 +53,10 @@ export function mockXHR() {
// for mock server
const responseFake = (url, type, respond) => {
return {
url: new RegExp(`/mock${url}`),
url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`),
type: type || 'get',
response(req, res) {
console.log('request invoke:' + req.path)
res.json(Mock.mock(respond instanceof Function ? respond(req, res) : respond))
}
}