mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Project Aphrodite
This commit is contained in:
22
frontend/src/Utilities/State/getSectionState.js
Normal file
22
frontend/src/Utilities/State/getSectionState.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import _ from 'lodash';
|
||||
|
||||
function getSectionState(state, section, isFullStateTree = false) {
|
||||
if (isFullStateTree) {
|
||||
return _.get(state, section);
|
||||
}
|
||||
|
||||
const [, subSection] = section.split('.');
|
||||
|
||||
if (subSection) {
|
||||
return Object.assign({}, state[subSection]);
|
||||
}
|
||||
|
||||
// TODO: Remove in favour of using subSection
|
||||
if (state.hasOwnProperty(section)) {
|
||||
return Object.assign({}, state[section]);
|
||||
}
|
||||
|
||||
return Object.assign({}, state);
|
||||
}
|
||||
|
||||
export default getSectionState;
|
Reference in New Issue
Block a user