I am unable to make a POST request using axios. I dispatch an action which further sends the axios POST request to backend. The function that route has to perform is to require the body received and save to mongodb atlas. But it fails and the catch block sends me this error:
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)