| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 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 | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2020-05-03 09:16:24 +00:00
										 |  |  |           case WALLET_HISTORY_SUCCESS: return initialState; | 
					
						
							| 
									
										
										
										
											2020-04-28 09:22:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |           default: { | 
					
						
							|  |  |  |                return state; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  | }; |