mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Add in /dev proxy for development
This commit is contained in:
parent
cb234fe1fc
commit
9d1f51c6ba
@ -25,12 +25,7 @@ module.exports = {
|
||||
htmlAttrs: {
|
||||
lang: 'en'
|
||||
},
|
||||
meta: [
|
||||
{ charset: 'utf-8' },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{ hid: 'description', name: 'description', content: '' },
|
||||
{ hid: 'robots', name: 'robots', content: 'noindex' }
|
||||
],
|
||||
meta: [{ charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: '' }, { hid: 'robots', name: 'robots', content: 'noindex' }],
|
||||
script: [],
|
||||
link: [
|
||||
{ rel: 'icon', type: 'image/x-icon', href: routerBasePath + '/favicon.ico' },
|
||||
@ -43,20 +38,10 @@ module.exports = {
|
||||
},
|
||||
|
||||
// Global CSS: https://go.nuxtjs.dev/config-css
|
||||
css: [
|
||||
'@/assets/tailwind.css',
|
||||
'@/assets/app.css'
|
||||
],
|
||||
css: ['@/assets/tailwind.css', '@/assets/app.css'],
|
||||
|
||||
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
||||
plugins: [
|
||||
'@/plugins/constants.js',
|
||||
'@/plugins/init.client.js',
|
||||
'@/plugins/axios.js',
|
||||
'@/plugins/toast.js',
|
||||
'@/plugins/utils.js',
|
||||
'@/plugins/i18n.js'
|
||||
],
|
||||
plugins: ['@/plugins/constants.js', '@/plugins/init.client.js', '@/plugins/axios.js', '@/plugins/toast.js', '@/plugins/utils.js', '@/plugins/i18n.js'],
|
||||
|
||||
// Auto import components: https://go.nuxtjs.dev/config-components
|
||||
components: true,
|
||||
@ -68,26 +53,25 @@ module.exports = {
|
||||
],
|
||||
|
||||
// Modules: https://go.nuxtjs.dev/config-modules
|
||||
modules: [
|
||||
'nuxt-socket-io',
|
||||
'@nuxtjs/axios',
|
||||
'@nuxtjs/proxy'
|
||||
],
|
||||
modules: ['nuxt-socket-io', '@nuxtjs/axios', '@nuxtjs/proxy'],
|
||||
|
||||
proxy: {
|
||||
[`${routerBasePath}/api/`]: { target: process.env.NODE_ENV !== 'production' ? serverHostUrl : '/' },
|
||||
[`${routerBasePath}/public/`]: { target: process.env.NODE_ENV !== 'production' ? serverHostUrl : '/' },
|
||||
[`${routerBasePath}/hls/`]: { target: process.env.NODE_ENV !== 'production' ? serverHostUrl : '/' }
|
||||
[`${routerBasePath}/hls/`]: { target: process.env.NODE_ENV !== 'production' ? serverHostUrl : '/' },
|
||||
[`${routerBasePath}/dev/`]: { target: process.env.NODE_ENV !== 'production' ? serverHostUrl : '/', pathRewrite: { '^/dev/': '' } }
|
||||
},
|
||||
|
||||
io: {
|
||||
sockets: [{
|
||||
sockets: [
|
||||
{
|
||||
name: 'dev',
|
||||
url: serverHostUrl
|
||||
},
|
||||
{
|
||||
name: 'prod'
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Axios module configuration: https://go.nuxtjs.dev/config-axios
|
||||
@ -136,7 +120,7 @@ module.exports = {
|
||||
postcssOptions: {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
autoprefixer: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -160,5 +144,5 @@ module.exports = {
|
||||
*/
|
||||
devServerHandlers: [],
|
||||
|
||||
ignore: ["**/*.test.*", "**/*.cy.*"]
|
||||
ignore: ['**/*.test.*', '**/*.cy.*']
|
||||
}
|
||||
|
@ -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,10 +14,11 @@ 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…
Reference in New Issue
Block a user