Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let callAPI = async ({ url, method, data }) => {
- return await Axios({ url, method, data });
- };
- export function* deleteItem({ id }) {
- try {
- const result = yield call(() =>
- callAPI({ url: `${API}/items/${id}`, method: 'DELETE' })
- );
- yield put(deleteItemSuccess(result.data));
- } catch (e) {
- yield put(deleteItemFail());
- }
- }
Add Comment
Please, Sign In to add comment