|
|
@@ -7,9 +7,10 @@ const service = axios.create({
|
|
|
baseURL: '/'
|
|
|
})
|
|
|
|
|
|
+const isServer = typeof window === 'undefined'
|
|
|
service.interceptors.request.use(config => {
|
|
|
// is server render, use ${baseUrl} directly rather than ${proxyUrl}
|
|
|
- if (typeof window === 'undefined') {
|
|
|
+ if (isServer) {
|
|
|
if (config.url.indexOf('/inquiry') === 0) {
|
|
|
config.url = process.env.commonUrl + config.url
|
|
|
} else {
|
|
|
@@ -39,11 +40,14 @@ service.interceptors.response.use(response => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (typeof window !== 'undefined') {
|
|
|
+ if (!isServer) {
|
|
|
document.getElementById('loading').setAttribute('class', 'loading')
|
|
|
}
|
|
|
return response
|
|
|
}, error => {
|
|
|
+ if (!isServer) {
|
|
|
+ document.getElementById('loading').setAttribute('class', 'loading')
|
|
|
+ }
|
|
|
return Promise.reject(error)
|
|
|
})
|
|
|
|