Skip to content

Commit

Permalink
Merge pull request #6545 from uktrade/fix/reducers
Browse files Browse the repository at this point in the history
Removed unnecessary reducers
  • Loading branch information
peterhudec authored Feb 28, 2024
2 parents a908cb3 + 28abf44 commit 8d81417
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/client/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,41 +181,7 @@ import getInteractionReducer from './modules/Interactions/InteractionDetails/red
import { PREVIEW_QUOTE_ID } from './modules/Omis/state'
import orderQuoteReducer from './modules/Omis/reducer'

const parseProps = (domNode) => {
if (!domNode) {
return {
modulePermissions: [],
currentAdviserId: '',
currentAdviserName: '',
activeFeatures: null,
activeFeatureGroups: null,
userPermissions: [],
csrfToken: '',
}
}
return 'props' in domNode.dataset ? JSON.parse(domNode.dataset.props) : {}
}

const appWrapper = document.getElementById('react-app')

const {
modulePermissions,
currentAdviserId,
currentAdviserName,
activeFeatures,
activeFeatureGroups,
userPermissions,
csrfToken,
} = parseProps(appWrapper)

export const reducers = {
currentAdviserId: () => currentAdviserId,
currentAdviserName: () => currentAdviserName,
activeFeatures: () => activeFeatures,
activeFeatureGroups: () => activeFeatureGroups,
modulePermissions: () => modulePermissions,
userPermissions: () => userPermissions,
csrfToken: () => csrfToken,
tasks,
[FLASH_MESSAGE_ID]: flashMessageReducer,
[COMPANY_LISTS_STATE_ID]: companyListsReducer,
Expand All @@ -236,8 +202,6 @@ export const reducers = {
...ContactForm.reducerSpread,
...Form.reducerSpread,
...FieldAddAnother.reducerSpread,
// A reducer is required to be able to set a preloadedState parameter
referrerUrl: (state = {}) => state,
[DNB_CHECK_ID]: dnbCheckReducer,
[INVESTMENT_OPPORTUNITIES_LIST_ID]: investmentOpportunitiesListReducer,
[INVESTMENT_OPPORTUNITIES_DETAILS_ID]: investmentOpportunitiesDetailsReducer,
Expand Down

0 comments on commit 8d81417

Please sign in to comment.