export const req = data => (
async dispatch => {
try {
dispatch({
type: types.GET_REQUEST,
});
const res = await api.getReq(data);
dispatch({
type: types.GET_SUCCESS,
payload: res,
});
dispatch(req2(res));
} catch (error) {
dispatch({
type: types.GET_ERROR,
});
}
}
);
const req2 = data => (
async dispatch => {
try {
dispatch({
type: types.GET_REQUEST2,
});
const res = await api.getReq2(data);
dispatch({
type: types.GET_SUCCESS2,
payload: res,
});
} catch (error) {
dispatch({
type: types.GET_ERROR2,
});
}
}
);
req = await api.getReq2(data);
export const req2 = data => (
async dispatch => {
try {
dispatch({
type: types.GET_REQUEST2,
});
let req = await api.getReq(data);
dispatch({
type: types.GET_SUCCESS2,
payload: req,
});
} catch (error) {
dispatch({
type: types.GET_ERROR2,
});
}
}
);
export const getReq = data => (
async (dispatch) => {
console.log(dispatch);
try {
await dispatch({
type: types.GET_REQUEST,
});
await api.getReq(data);
await dispatch({
type: types.GET_SUCCESS,
payload: data,
});
await dispatch({
type: types.GET_REQUEST2,
});
await api.getReq2(data);
console.log(data);
await dispatch({
type: types.GET_SUCCESS2,
payload: data,
});
} catch (error) {
await dispatch({
type: types.GET_ERROR,
});
}
}
);
await dispatch({
type: types.GET_REQUEST2,
});
await api.getReq2(data);
console.log(data);
await dispatch({
type: types.GET_SUCCESS2,
payload: data,
});