mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-18 01:44:33 +02:00
Add in /dev proxy for development
This commit is contained in:
parent
cb234fe1fc
commit
9d1f51c6ba
2 changed files with 26 additions and 41 deletions
|
@ -1,5 +1,5 @@
|
|||
export default function ({ $axios, store, $config }) {
|
||||
$axios.onRequest(config => {
|
||||
$axios.onRequest((config) => {
|
||||
if (!config.url) {
|
||||
console.error('Axios request invalid config', config)
|
||||
return
|
||||
|
@ -14,12 +14,13 @@ export default function ({ $axios, store, $config }) {
|
|||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log('Making request to ' + config.url)
|
||||
config.url = `/dev${config.url}`
|
||||
}
|
||||
})
|
||||
|
||||
$axios.onError(error => {
|
||||
$axios.onError((error) => {
|
||||
const code = parseInt(error.response && error.response.status)
|
||||
const message = error.response ? error.response.data || 'Unknown Error' : 'Unknown Error'
|
||||
console.error('Axios error', code, message)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue