35 lines
996 B
JavaScript
35 lines
996 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
|
||
|
}
|
||
|
case WALLET_HISTORY_SUCCESS: return initialState;
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
};
|