Skip to content

Commit

Permalink
Simplify reducer and make sure data descriptions are more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
coder-karen committed Jan 24, 2025
1 parent 26f66a4 commit a029012
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const items = ( state = { fetchingCustomContentTypeStatus: false }, actio
return {
...state,
fetchingCustomContentTypeStatus: false,
customContentTypeActive: action.customContentTypeActive,
sub_features: action.sub_features || {}, // Store sub-features
featureData: action.feature_data,
};
case CUSTOM_FEATURE_ACTIVE_FETCH_FAIL:
return { ...state, fetchingCustomContentTypeStatus: false, error: action.error };
Expand All @@ -24,24 +23,6 @@ export const items = ( state = { fetchingCustomContentTypeStatus: false }, actio
}
};

const requests = ( state = { fetchingCustomContentTypeStatus: false }, action ) => {
switch ( action.type ) {
case CUSTOM_FEATURE_ACTIVE_FETCH:
return assign( {}, state, {
fetchingCustomContentTypeStatus: true,
} );
case CUSTOM_FEATURE_ACTIVE_FETCH_FAIL:
case CUSTOM_FEATURE_ACTIVE_FETCH_SUCCESS:
return assign( {}, state, {
fetchingCustomContentTypeStatus: false,
} );

default:
return state;
}
};

export const reducer = combineReducers( {
items,
requests,
} );

0 comments on commit a029012

Please sign in to comment.