27 lines
1.0 KiB
JavaScript
27 lines
1.0 KiB
JavaScript
|
import axios from "axios";
|
||
|
import { walletActionUrl } from "./IlinkConstants";
|
||
|
import { fetchWalletListPending, fetchWalletListSuccess, fetchWalletListError } from "../redux/actions/WalletActions";
|
||
|
|
||
|
const getWalletActivated = (userID) => {
|
||
|
|
||
|
return dispatch => {
|
||
|
dispatch(fetchWalletListPending());
|
||
|
|
||
|
axios.post(`${walletActionUrl}/${userID}/activated`)
|
||
|
.then(response => {
|
||
|
console.log(response);
|
||
|
dispatch(fetchWalletListSuccess(response));
|
||
|
})
|
||
|
.catch(error => {
|
||
|
dispatch(fetchWalletListError(error.message));
|
||
|
if (error.response)
|
||
|
dispatch(fetchWalletListError(error.response));
|
||
|
else if (error.request)
|
||
|
dispatch(fetchWalletListError(error.request))
|
||
|
else
|
||
|
dispatch(fetchWalletListError(error.message))
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default getWalletActivated;
|