35 lines
884 B
JavaScript
35 lines
884 B
JavaScript
|
import { WALLET_LIST_PENDING, WALLET_LIST_SUCCESS, WALLET_LIST_ERROR } from "../types/WalletType";
|
||
|
import { DEPOSIT_PENDING, DEPOSIT_SUCCESS, DEPOSIT_ERROR } from "../types/DepositType";
|
||
|
|
||
|
const initialState = {
|
||
|
loading: false,
|
||
|
result: null,
|
||
|
error: null,
|
||
|
};
|
||
|
|
||
|
export default (state = initialState, action) => {
|
||
|
switch (action.type) {
|
||
|
case DEPOSIT_PENDING: return {
|
||
|
...state,
|
||
|
loading: true
|
||
|
}
|
||
|
case DEPOSIT_SUCCESS: return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
result: action.result.data,
|
||
|
error: null
|
||
|
}
|
||
|
case DEPOSIT_ERROR: return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
result: null,
|
||
|
error: action.result
|
||
|
}
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
};
|