0
내 필터 함수는 내 filter.sql에서 사용하고자하는 두 개의 매개 변수를 보내지 만 항상 유용하지는 않습니다. 어떤 시점에서 컨트롤러 파일에 매개 변수가 전달되지 않는다는 것을 알 수 없습니다. 끝점으로 보내지기 전에 정의되지만 컨트롤러 함수에서 해당 값을 사용하려고하므로 정의되지 않았습니다.계속 가져 오기 ReferenceError : fter is not
1 필터 함수 :
handleFilter() {
console.log(this.state.filter);
console.log(this.state.filterText);
if (this.props.searchText === "") {
axios
.post("/api/filter", { fText: this.state.filterText, fter:
this.state.filter })
.then(response => {
this.props.updateCSR(response.data);
updateFPO(this.props.filterPopout === false ? true : false);
});
} else {
axios
.post(
"/api/sfilter",
{
fText: this.state.filterText,
fter: this.state.filter,
sText: this.props.searchText
}
)
.then(response => {
this.props.updateCSR(response.data);
updateFPO(this.props.filterPopout === false ? true : false);
});
}
}
끝점 : 컨트롤러
app.post("/api/filter", ic.filter);
app.post("/api/sfilter", ic.sfilter);
필터 :
filter: (req, res, next) => {
const { filter, filterText } = req.body;
const dbInstance = req.app.get("db");
dbInstance
.filter([fter, fText])
.then(resp => {
res.status(200).send(resp);
})
.catch(() => res.status(500).send());
},
sfilter: (req, res, next) => {
const { fter, fText, sText } = req.body;
const dbInstance = req.app.get("db");
dbInstance
.sfilter([fter, fText, sText])
.then(resp => {
res.status(200).send(resp);
})
.catch(() => res.status(500).send());
}
ERR 또는 프런트 엔드 용 콘솔에서
POST http://localhost:3000/api/filter 500 (Internal Server Error)
dispatchXhrRequest @ xhr.js:178
xhrAdapter @ xhr.js:12
dispatchRequest @ dispatchRequest.js:52
Promise resolved (async)
request @ Axios.js:58
Axios.(anonymous function) @ Axios.js:78
wrap @ bind.js:9
handleFilter @ Filter.js:33
onClick @ Filter.js:79
callCallback @ react-dom.development.js:1299
invokeGuardedCallbackDev @ react-dom.development.js:1338
invokeGuardedCallback @ react-dom.development.js:1195
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:1209
executeDispatch @ react-dom.development.js:1432
executeDispatchesInOrder @ react-dom.development.js:1454
executeDispatchesAndRelease @ react-dom.development.js:1969
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:1980
forEachAccumulated @ react-dom.development.js:1946
processEventQueue @ react-dom.development.js:2139
runEventQueueInBatch @ react-dom.development.js:2151
handleTopLevel @ react-dom.development.js:2161
handleTopLevelImpl @ react-dom.development.js:1800
batchedUpdates @ react-dom.development.js:13238
performFiberBatchedUpdates @ react-dom.development.js:1646
stackBatchedUpdates @ react-dom.development.js:1637
batchedUpdates @ react-dom.development.js:1651
batchedUpdatesWithControlledComponents @ react-dom.development.js:1664
dispatchEvent @ react-dom.development.js:1874
createError.js:16 Uncaught (in promise) Error: Request failed with status code 500
at createError (createError.js:16)
at settle (settle.js:18)
at XMLHttpRequest.handleLoad (xhr.js:77)
여기 무슨 일이 일어나고 있습니까? 나는 다른 곳에서이 문제를 겪었지만 지금은 그것을 무시할 수 없다. 나는 그것을 고쳐야한다. 그러나 그것은 준수하지 않고있다!!
시간 내 주셔서 감사합니다 !!!!!
나는 당신이 말하는 것을보고 있습니다. 나는 이것을 바꿨다. (나는 이것을 이전에 바꾸 었다고 생각했다.) 그것은 여전히 부러졌습니다. :(메시지를 업데이트하는 중 오류가 발생했습니다. 포함하는 것을 잊었습니다. –