/** * Project iLinkCity * File SearchUserReducer * Path redux/reducers/WalletReducer * Created by BRICE ZELE * Date: 26/07/2021 */ import * as WalletType from "../../types/WalletType"; const initialState = { loading: false, result: null, error: null }; export default (state = initialState, action) => { switch (action.type) { case WalletType.SEARCH_USER_PENDING: return { ...state, loading: true } case WalletType.SEARCH_USER_SUCCESS: return { ...state, loading: false, result: action.result.data, error: null } case WalletType.SEARCH_USER_ERROR: return { ...state, loading: false, result: null, error: action.result } case WalletType.SEARCH_USER_RESET: return initialState; default: { return state; } } };