ilink-world/redux/reducers/WalletReducer.js

34 lines
809 B
JavaScript
Raw Normal View History

2020-04-17 22:03:04 +00:00
import { WALLET_LIST_PENDING, WALLET_LIST_SUCCESS, WALLET_LIST_ERROR } from "../types/WalletType";
const initialState = {
loading: false,
result: null,
error: null,
};
2020-04-18 19:59:05 +00:00
export default (state = initialState, action) => {
2020-04-17 22:03:04 +00:00
switch (action.type) {
case WALLET_LIST_PENDING: return {
...state,
loading: true
}
case WALLET_LIST_SUCCESS: return {
...state,
2020-04-18 19:59:05 +00:00
loading: false,
result: action.result.data,
2020-04-17 22:03:04 +00:00
error: null
}
case WALLET_LIST_ERROR: return {
...state,
loading: false,
2020-04-18 19:59:05 +00:00
result: null,
error: action.result,
}
default: {
return state;
2020-04-17 22:03:04 +00:00
}
}
2020-04-18 19:59:05 +00:00
};