46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
|
import {store} from "../../redux/store";
|
||
|
import axios from "axios";
|
||
|
import I18n from 'react-native-i18n';
|
||
|
import { envoieUserWalletToWallet} from "../IlinkConstants";
|
||
|
|
||
|
import {
|
||
|
fetchEnvoieUserWalletToWalletSuccess,
|
||
|
fetchEnvoieUserWalletToWalletError,
|
||
|
}from "../../redux/actions/EnvoieUserType";
|
||
|
|
||
|
export const payment_transaction = (data) => {
|
||
|
|
||
|
const auth = store.getState().authKeyReducer;
|
||
|
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||
|
|
||
|
return dispatch => {
|
||
|
|
||
|
axios({
|
||
|
url: `${envoieUserWalletToWallet }`,
|
||
|
method: 'POST',
|
||
|
data,
|
||
|
headers: {
|
||
|
'Authorization': authKey,
|
||
|
'X-Localization': I18n.currentLocale()
|
||
|
}
|
||
|
})
|
||
|
.then(response => {
|
||
|
console.log(response);
|
||
|
dispatch(fetchEnvoieUserWalletToWalletSuccess(response));
|
||
|
})
|
||
|
.catch(error => {
|
||
|
if (error.response)
|
||
|
dispatch(fetchEnvoieUserWalletToWalletError(error.response));
|
||
|
else if (error.request)
|
||
|
dispatch(fetchEnvoieUserWalletToWalletError(error.request))
|
||
|
else
|
||
|
dispatch(fetchEnvoieUserWalletToWalletError(error.message))
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const modifyAvisImpositionReset = () => {
|
||
|
return dispatch => {
|
||
|
dispatch(fetchModifyAvisImpositionReset());
|
||
|
}
|
||
|
}
|