34 lines
936 B
JavaScript
34 lines
936 B
JavaScript
import { WALLET_HISTORY_PENDING, WALLET_HISTORY_SUCCESS, WALLET_HISTORY_ERROR } from "../types/WalletType";
|
|
|
|
const initialState = {
|
|
loadingTransaction: false,
|
|
resultTransaction: null,
|
|
errorTransaction: null,
|
|
};
|
|
|
|
export default (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case WALLET_HISTORY_PENDING: return {
|
|
...state,
|
|
loadingTransaction: true
|
|
}
|
|
case WALLET_HISTORY_SUCCESS: return {
|
|
...state,
|
|
loadingTransaction: false,
|
|
resultTransaction: action.result.data,
|
|
errorTransaction: null
|
|
}
|
|
case WALLET_HISTORY_ERROR: return {
|
|
...state,
|
|
loadingTransaction: false,
|
|
resultTransaction: null,
|
|
errorTransaction: action.result
|
|
}
|
|
|
|
default: {
|
|
return state;
|
|
}
|
|
|
|
}
|
|
};
|