45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
|
/**
|
||
|
* Project iLinkCity
|
||
|
* File GetQRCodeDetailReducer
|
||
|
* Path redux/reducers/WalletReducer
|
||
|
* Created by BRICE ZELE
|
||
|
* Date: 19/08/2021
|
||
|
*/
|
||
|
import * as WalletType from "../../types/WalletType";
|
||
|
|
||
|
const initialState = {
|
||
|
loading: false,
|
||
|
result: null,
|
||
|
error: null
|
||
|
};
|
||
|
|
||
|
export default (state = initialState, action) => {
|
||
|
switch (action.type) {
|
||
|
case WalletType.GET_QR_CODE_DETAIL_PENDING:
|
||
|
return {
|
||
|
...state,
|
||
|
loading: true
|
||
|
}
|
||
|
case WalletType.GET_QR_CODE_DETAIL_SUCCESS:
|
||
|
return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
result: action.result.data,
|
||
|
error: null
|
||
|
}
|
||
|
case WalletType.GET_QR_CODE_DETAIL_ERROR:
|
||
|
return {
|
||
|
...state,
|
||
|
loading: false,
|
||
|
result: null,
|
||
|
error: action.result
|
||
|
}
|
||
|
case WalletType.GET_QR_CODE_DETAIL_RESET:
|
||
|
return initialState;
|
||
|
|
||
|
default: {
|
||
|
return state;
|
||
|
}
|
||
|
}
|
||
|
};
|