我无法使用 axios 发出 POST 请求。我调度了一个动作,进一步将 axios POST 请求发送到后端。route 必须执行的功能是要求接收 body 并保存到 mongodb atlas。但它失败了,catch 块向我发送了这个错误:
enter code here
POST http: //localhost:5000/posts/api/newPost 409 (Conflict)
dispatchXhrRequest @ xhr.js: 177
xhrAdapter @ xhr.js: 13
dispatchRequest @ dispatchRequest.js: 52
Promise.then(async)
request @ Axios.js: 61
Axios. < computed > @ Axios.js: 87
wrap @ bind.js: 9
createPost @ index.js: 6(anonymous) @ posts.js: 6(anonymous) @ index.js: 8
handleSubmit @ Form.js: 23
callCallback @ react - dom.development.js: 3945
invokeGuardedCallbackDev @ react - dom.development.js: 3994
invokeGuardedCallback @ react - dom.development.js: 4056
invokeGuardedCallbackAndCatchFirstError @ react - dom.development.js: 4070
executeDispatch @ react - dom.development.js: 8243
processDispatchQueueItemsInOrder @ react - dom.development.js: 8275
processDispatchQueue @ react - dom.development.js: 8288
dispatchEventsForPlugins @ react - dom.development.js: 8299(anonymous) @ react - dom.development.js: 8508
batchedEventUpdates$1 @ react - dom.development.js: 22396
batchedEventUpdates @ react - dom.development.js: 3745
dispatchEventForPluginEventSystem @ react - dom.development.js: 8507
attemptToDispatchEvent @ react - dom.development.js: 6005
dispatchEvent @ react - dom.development.js: 5924
unstable_runWithPriority @ scheduler.development.js: 468
runWithPriority$1 @ react - dom.development.js: 11276
discreteUpdates$1 @ react - dom.development.js: 22413
discreteUpdates @ react - dom.development.js: 3756
dispatchDiscreteEvent @ react - dom.development.js: 5889
posts.js: 9 Error: Request failed with status code 409
at createError(createError.js: 16)
at settle(settle.js: 17)
at XMLHttpRequest.handleLoad(xhr.js: 62)
Error: Request failed with status code 409
at createError (createError.js:16)
at settle (settle.js:17)
at XMLHttpRequest.handleLoad (xhr.js:62)