2020-05-03 09:16:24 +00:00
|
|
|
import { DEPOSIT_PENDING, DEPOSIT_SUCCESS, DEPOSIT_ERROR, DEPOSIT_RESET } from "../types/DepositType";
|
2020-04-24 15:11:08 +00:00
|
|
|
|
|
|
|
const initialState = {
|
|
|
|
loading: false,
|
|
|
|
result: null,
|
2020-05-03 09:16:24 +00:00
|
|
|
error: null
|
2020-04-24 15:11:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
2020-05-03 09:16:24 +00:00
|
|
|
case DEPOSIT_RESET: return initialState;
|
2020-04-24 15:11:08 +00:00
|
|
|
|
|
|
|
default: {
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|