34 lines
948 B
JavaScript
34 lines
948 B
JavaScript
import { CASSER_EPARGNE_USER_PENDING, CASSER_EPARGNE_USER_SUCCESS, CASSER_EPARGNE_USER_ERROR, CASSER_EPARGNE_USER_RESET } from "../types/NanoCreditType";
|
|
|
|
const initialState = {
|
|
loading: false,
|
|
result: null,
|
|
error: null
|
|
};
|
|
|
|
export default (state = initialState, action) => {
|
|
switch (action.type) {
|
|
case CASSER_EPARGNE_USER_PENDING: return {
|
|
...state,
|
|
loading: true
|
|
}
|
|
case CASSER_EPARGNE_USER_SUCCESS: return {
|
|
...state,
|
|
loading: false,
|
|
result: action.result.data,
|
|
error: null
|
|
}
|
|
case CASSER_EPARGNE_USER_ERROR: return {
|
|
...state,
|
|
loading: false,
|
|
result: null,
|
|
error: action.result
|
|
}
|
|
case CASSER_EPARGNE_USER_RESET: return initialState;
|
|
|
|
default: {
|
|
return state;
|
|
}
|
|
}
|
|
};
|