Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const setLocale = locale => async dispatch => {
if (!Object.keys(TranslatorContext.context.translations).includes(locale)) {
const response = await axios.get(`i18n/${locale}.json?buildTimestamp=${process.env.BUILD_TIMESTAMP}`, { baseURL: '' });
TranslatorContext.registerTranslations(locale, response.data);
}
dispatch({
type: ACTION_TYPES.SET_LOCALE,
locale
});
};
export const setLocale = locale => async dispatch => {
if (Object.keys(TranslatorContext.context.translations).indexOf(locale) === -1) {
const response = await axios.get(`i18n/${locale}.json?buildTimestamp=${process.env.BUILD_TIMESTAMP}`);
TranslatorContext.registerTranslations(locale, response.data);
}
dispatch({
type: ACTION_TYPES.SET_LOCALE,
locale
});
};