33 POST_UPDATE_CONSUMABLE_START ,
44 POST_UPDATE_CONSUMABLE_END ,
55 POST_UPDATE_CONSUMABLE_ERROR ,
6+ UPDATE_CONSUMABLE_STATUS_START ,
7+ UPDATE_CONSUMABLE_STATUS_END ,
8+ UPDATE_CONSUMABLE_STATUS_ERROR ,
69} from '../../constants/bmdashboard/consumableConstants' ;
710
811const defaultState = {
@@ -17,6 +20,11 @@ const defaultState = {
1720 result : null ,
1821 error : undefined ,
1922 } ,
23+ updateConsumableStatus : {
24+ loading : false ,
25+ result : null ,
26+ error : undefined ,
27+ } ,
2028} ;
2129
2230// eslint-disable-next-line import/prefer-default-export, default-param-last
@@ -58,6 +66,29 @@ export const consumablesReducer = (consumables = defaultState, action) => {
5866 consumables . updateConsumables = obj ;
5967 return { ...consumables } ;
6068 }
69+ case UPDATE_CONSUMABLE_STATUS_START : {
70+ // eslint-disable-next-line no-param-reassign
71+ consumables . updateConsumableStatus = { loading : true , result : null , error : undefined } ;
72+ return { ...consumables } ;
73+ }
74+ case UPDATE_CONSUMABLE_STATUS_END : {
75+ // eslint-disable-next-line no-param-reassign
76+ consumables . updateConsumableStatus = {
77+ loading : false ,
78+ result : action . payload ,
79+ error : false ,
80+ } ;
81+ return { ...consumables } ;
82+ }
83+ case UPDATE_CONSUMABLE_STATUS_ERROR : {
84+ // eslint-disable-next-line no-param-reassign
85+ consumables . updateConsumableStatus = {
86+ loading : false ,
87+ result : action . payload ,
88+ error : true ,
89+ } ;
90+ return { ...consumables } ;
91+ }
6192 default :
6293 return consumables ;
6394 }
0 commit comments