deploy to gcloud

This commit is contained in:
polv committed 2020-12-16 14:13:51 +07:00
1 parent e4e364ae2a
commit 4b7252c15f
12 files changed
+190 -121

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
import { Plugin } from '@nuxt/types'
const plugin: Plugin = ({ $axios, error }) => {
if (typeof location !== 'undefined') {
$axios.defaults.baseURL = location.origin
}
$axios.interceptors.response.use(
(r) => {
if (r.data?.error) {
error({
statusCode: r.status,
message: r.data.error,
})
throw new Error(r.data.error)
}
return r
},
(err) => {
error({
statusCode: err.response.status,
message: err.toJSON(),
})
return Promise.reject(err)
}
)
}
export default plugin