1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 21:00:13 +01:00
metamask-extension/ui/app/ducks/locale/locale.js
Mark Stacey b0b99fa748
Move action constants to separate module (#8308)
The "global" action constants (the ones previously in `actions.js`)
have been moved to a separate module. This was necessary to avoid a
circular dependency in an upcoming change that was causing problems.

In general the "ducks" pattern of organizing Redux stores does result
in circular dependency problems. This is because reuse of actions
between reducers is encouraged, so it's not uncommon for two reducers
to want to reference an action from the other. Going forward we can
avoid this problem by moving action constants that are shared between
reducers into this shared module.
2020-04-08 21:35:37 -03:00

18 lines
463 B
JavaScript

import actionConstants from '../../store/actionConstants'
export default function reduceLocaleMessages (state = {}, { type, value }) {
switch (type) {
case actionConstants.SET_CURRENT_LOCALE:
return {
...state,
current: value.messages,
}
default:
return state
}
}
export const getCurrentLocaleMessages = (state) => state.localeMessages.current
export const getEnLocaleMessages = (state) => state.localeMessages.en