Fix bugs.

This commit is contained in:
Ahmed Bouhuolia
2020-05-12 04:40:42 +02:00
parent 4ab85eaf09
commit 5ffb54992e
22 changed files with 221 additions and 115 deletions

View File

@@ -65,5 +65,14 @@ export const fetchItem = ({ id }) => {
};
export const deleteItem = ({ id }) => {
return dispatch => ApiService.delete(`items/${id}`);
return dispatch => new Promise((resolve, reject) => {
ApiService.delete(`items/${id}`)
.then((response) => {
dispatch({
type: t.ITEM_DELETE,
payload: { id },
});
resolve(response);
}).catch((error) => { reject(error); });
});
};