Skip to content

Commit

Permalink
refactor(actions): make UI_LOCALES_FETCHED an FSA
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Sep 22, 2017
1 parent d70ee36 commit 60e9bae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
@@ -1,7 +1,7 @@
export const TOGGLE_GLOSSARY = 'TOGGLE_GLOSSARY'
export const TOGGLE_HEADER = 'TOGGLE_HEADER'
export const TOGGLE_KEY_SHORTCUTS = 'TOGGLE_KEY_SHORTCUTS'
export const UI_LOCALES_FETCHED = Symbol('UI_LOCALES_FETCHED')
export const UI_LOCALES_FETCHED = 'UI_LOCALES_FETCHED'
export const CHANGE_UI_LOCALE = Symbol('CHANGE_UI_LOCALE')
export const DOCUMENT_SELECTED = Symbol('DOCUMENT_SELECTED')
export const LOCALE_SELECTED = Symbol('LOCALE_SELECTED')
Expand Down
Expand Up @@ -33,12 +33,8 @@ const unwrapResponse = (dispatch, errorMsg, response) => {
return response.json()
}

export function uiLocaleFetched (uiLocales) {
return {
type: UI_LOCALES_FETCHED,
data: uiLocales
}
}
export const uiLocaleFetched = createAction(UI_LOCALES_FETCHED)

export function fetchUiLocales () {
return (dispatch) => {
fetchLocales()
Expand Down
Expand Up @@ -92,7 +92,7 @@ const ui = (state = defaultState, action) => {
})

case UI_LOCALES_FETCHED:
const locales = prepareLocales(action.data)
const locales = prepareLocales(action.payload)
return update({
uiLocales: {
$set: locales
Expand Down
Expand Up @@ -102,7 +102,7 @@ describe('ui-reducer test', () => {
it('can record fetched UI locales', () => {
const withUiLocales = uiReducer(undefined, {
type: UI_LOCALES_FETCHED,
data: [
payload: [
{
localeId: 'en-US',
displayName: 'English (United States)'
Expand Down

0 comments on commit 60e9bae

Please sign in to comment.