0
HTTP 요청에 슈퍼 에이전트를 사용하고 있으며 HTTP 요청을 잡기 위해 superagent-intercept를 사용하여 오류 및 필요한 리디렉션을 관리하려고합니다.Vue JS/superagent - TypeError : fn이 함수가 아닙니다.
forms.get = function(root, cb) {
request
.get(`${api}/forms/name/FORM`)
.use(interceptor.auth)
.use(nocache)
.withCredentials()
.set('Accept', 'application/json')
.end(function(err, res) {
if (res.body.status === 'success') {
cb(res.body.data.forms, root)
} else if (common.token(res)) {
common.cb(root);
} else {
console.log("error");
}
});
};
이 고려 :
interceptor.auth = require('superagent-intercept')((error, results) => {
// Error handling ..
});
하지만 GLOBAL_DATA에서 오류가 전화
GLOBAL_DATA({commit, state}) {
forms_store.get(null, (result) => {
commit('SET_FORMS', result)
});
}
하십시오 componant 내가 Vuex에서 작업을 호출 장착
:
TypeError: fn is not a function
언젠가는 무언가가 무시 될 것이라고 생각하지만 해결 방법을 찾을 수 없습니다.
편집 :
GLOBAL_DATA : (context) => {
forms_store.get(null, (result) => {
context.commit('SET_FORMS', result)
});
내 코드를 편집하고 게시물,하지만 난 여전히 아주 동일한 오류가 있습니다. 무슨 일이 일어나고 있는지 아십니까? – kwn