64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
|
import {testBaseUrl} from "../../webservice/IlinkConstants";
|
||
|
import {ApiAction} from "../reducers";
|
||
|
import CreditActions from "./credit.type";
|
||
|
|
||
|
|
||
|
/************************************************************/
|
||
|
export const fetchRefillAgentPending = () => ({
|
||
|
type: CreditActions.REFILL_AGENT_CREDIT_PENDING
|
||
|
});
|
||
|
|
||
|
export const fetchRefillAgentReset = () => ({
|
||
|
type: CreditActions.REFILL_AGENT_CREDIT_RESET,
|
||
|
});
|
||
|
|
||
|
export const fetchRefillAgentSuccess = (authkey) => ({
|
||
|
type: CreditActions.REFILL_AGENT_CREDIT_SUCCESS,
|
||
|
payload: authkey,
|
||
|
});
|
||
|
|
||
|
export const fetchRefillAgentError = (error) => ({
|
||
|
type: CreditActions.REFILL_AGENT_CREDIT_ERROR,
|
||
|
payload: error,
|
||
|
});
|
||
|
|
||
|
export const fetchRefillAgent = () => {
|
||
|
return ApiAction({
|
||
|
url: `${testBaseUrl}/walletService/refillAgents`,
|
||
|
method: 'GET',
|
||
|
onLoading: fetchRefillAgentPending,
|
||
|
onSuccess: fetchRefillAgentSuccess,
|
||
|
onError: fetchRefillAgentError,
|
||
|
});
|
||
|
};
|
||
|
|
||
|
/************************************************************/
|
||
|
export const fetchRequestCreditPending = () => ({
|
||
|
type: CreditActions.DEMANDE_CREDIT_PENDING
|
||
|
});
|
||
|
|
||
|
export const fetchRequestCreditReset = () => ({
|
||
|
type: CreditActions.DEMANDE_CREDIT_RESET,
|
||
|
});
|
||
|
|
||
|
export const fetchRequestCreditSuccess = (authkey) => ({
|
||
|
type: CreditActions.DEMANDE_CREDIT_SUCCESS,
|
||
|
payload: authkey,
|
||
|
});
|
||
|
|
||
|
export const fetchRequestCreditError = (error) => ({
|
||
|
type: CreditActions.DEMANDE_CREDIT_ERROR,
|
||
|
payload: error,
|
||
|
});
|
||
|
|
||
|
export const fetchRequestCredit = (data) => {
|
||
|
return ApiAction({
|
||
|
url: `${testBaseUrl}/walletService/credits/storeDemand`,
|
||
|
data,
|
||
|
method: 'POST',
|
||
|
onLoading: fetchRequestCreditPending,
|
||
|
onSuccess: fetchRequestCreditSuccess,
|
||
|
onError: fetchRequestCreditError,
|
||
|
});
|
||
|
};
|