Answer the question
In order to leave comments, you need to log in
Unknown error: Cannot read property 'get' of undefined?
Hello, I encountered this error:
Code:
main.js:
import API from './services/Api.js'
API.interceptors.response.use(
response => {
if (response.data instanceof Blob) {
return response.data
}
return response.data.data || {}
},
error => {
if (error.response) {
Vue.prototype.$buefy.toast.open({
message: error.response.data.message || 'Something went wrong',
type: 'is-danger'
})
} else {
Vue.prototype.$buefy.toast.open({
message: 'Unable to connect to server',
type: 'is-danger'
})
}
return Promise.reject(error)
}
)
Vue.prototype.$http = API
import axios from 'axios'
import { cacheAdapterEnhancer } from 'axios-extensions'
export default axios.create({
baseURL: 'http://api.ivinete.loc/method/',
headers: { 'Cache-Control': 'no-cache' },
// cache will be enabled by default
adapter: cacheAdapterEnhancer(axios.defaults.adapter)
})
actions: {
login ({commit}, user) {
return new Promise((resolve, reject) => {
commit('clearError')
commit('setLoading', true)
const data = this.$http.get('oauth.login', { params: user })
console.log(data)
})
}
}
Answer the question
In order to leave comments, you need to log in
Why does no one ever read the bugs? Since when is TypeError an unknown error? This is a type error, the variable is not of the expected type. undefined is a separate type in JS
TypeError: Cannot read property 'get' of undefined.
TypeError: Cannot read property 'get' because it is not defined.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question