43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
|
import {
|
||
|
ENVOIE_WALLET_TO_BANK_USER_ERROR,
|
||
|
ENVOIE_WALLET_TO_BANK_USER_PENDING,
|
||
|
ENVOIE_WALLET_TO_BANK_USER_RESET,
|
||
|
ENVOIE_WALLET_TO_BANK_USER_SUCCESS
|
||
|
} from "../types/EnvoieUserType";
|
||
|
|
||
|
const initialState = {
|
||
|
loading: false,
|
||
|
result: null,
|
||
|
error: null
|
||
|
};
|
||
|
|
||
|
export default (state = initialState, action) => {
|
||
|
switch (action.type) {
|
||
|
case ENVOIE_WALLET_TO_BANK_USER_PENDING:
|
||
|
return {
|
||
|
...state,
|
||
|
loading: true
|
||
|
}
|
||
|
case ENVOIE_WALLET_TO_BANK_USER_SUCCESS:
|
||
|
return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
result: action.result.data,
|
||
|
error: null
|
||
|
}
|
||
|
case ENVOIE_WALLET_TO_BANK_USER_ERROR:
|
||
|
return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
result: null,
|
||
|
error: action.result
|
||
|
}
|
||
|
case ENVOIE_WALLET_TO_BANK_USER_RESET:
|
||
|
return initialState;
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
};
|