Answer the question
In order to leave comments, you need to log in
How to render the page after deleting a product from the list?
There is an API where you can do different manipulations on the product. When testing through postman endpoints, everything is fine.
There is an application, UI on React with Redux. The user who deletes / creates / edits on the front can do everything.
BUT! The problem is that when the user performs some operation from the above:
the request is sent - and the corresponding operation is performed
after that, changes have occurred in the database, BUT! the old information remained AND ONLY after the new submission of the change -> the product is changed / deleted;
export const editCategory = (type, editedCategory, session = '', callback) => {
switch(type) {
case 'remove': {
fetch(IP_BACK + CATEGORIES + `${editedCategory.id}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + session,
},
})
.then(data => data.json())
.then(data => {
return dispatch => {
if (callback) {
dispatch(callback());
}
}
})
.catch(err => console.log('Error while removing user', err));
break;
}
default: {
return;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question