simba-mobile-cad3/app/redux/reducers/EnvoieUserWalletToBankReduc...

43 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2025-01-07 09:47:45 +00:00
import {
ENVOIE_WALLET_TO_BANK_USER_ERROR,
ENVOIE_WALLET_TO_BANK_USER_PENDING,
ENVOIE_WALLET_TO_BANK_USER_RESET,
ENVOIE_WALLET_TO_BANK_USER_SUCCESS
} from "../types/EnvoieUserType";
const initialState = {
loading: false,
result: null,
error: null
};
export default (state = initialState, action) => {
switch (action.type) {
case ENVOIE_WALLET_TO_BANK_USER_PENDING:
return {
...state,
loading: true
}
case ENVOIE_WALLET_TO_BANK_USER_SUCCESS:
return {
...state,
loading: false,
result: action.result.data,
error: null
}
case ENVOIE_WALLET_TO_BANK_USER_ERROR:
return {
...state,
loading: false,
result: null,
error: action.result
}
case ENVOIE_WALLET_TO_BANK_USER_RESET:
return initialState;
default: {
return state;
}
}
};