Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
…into render_word_with_text
  • Loading branch information
naveed-ahmad committed Mar 15, 2017
commit b3ee49f6f74147aa55b334a02d58e1a79ad6d4d1
10 changes: 9 additions & 1 deletion src/redux/actions/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import {
LOAD_RECITERS,
LOAD_RECITERS_SUCCESS,
LOAD_RECITERS_FAIL,
SET_USER_AGENT
SET_USER_AGENT,
LOAD_TRANSLATIONS,
LOAD_TRANSLATIONS_SUCCESS,
LOAD_TRANSLATIONS_FAIL
} from 'redux/constants/options.js';

export function isReadingMode(globalState) {
Expand Down Expand Up @@ -34,3 +37,8 @@ export function setUserAgent(userAgent) {
userAgent
};
}

export const loadTranslations = () => ({
types: [LOAD_TRANSLATIONS, LOAD_TRANSLATIONS_SUCCESS, LOAD_TRANSLATIONS_FAIL],
promise: client => client.get('/api/v3/options/translations')
});
20 changes: 19 additions & 1 deletion src/redux/modules/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import {
SET_OPTION,
LOAD_RECITERS,
LOAD_RECITERS_SUCCESS,
SET_USER_AGENT
SET_USER_AGENT,
LOAD_TRANSLATIONS,
LOAD_TRANSLATIONS_SUCCESS
} from 'redux/constants/options.js';

const initialState = {
Expand Down Expand Up @@ -56,6 +58,22 @@ export default function reducer(state = initialState, action = {}) {
userAgent
};
}
case LOAD_TRANSLATIONS: {
return {
...state,
loadingTranslations: true
};
}
case LOAD_TRANSLATIONS_SUCCESS: {
return {
...state,
loadingTranslations: false,
options: {
...state.options,
translations: action.result.translations
}
};
}
default:
return state;
}
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.