decoding.ts 481 Bytes
Newer Older
Oleksii Savran's avatar
Redux  
Oleksii Savran committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { VocabularyService } from '@genesys/client/service';
import { RECEIVE_COUNTRY_CODES_DECODED } from 'core/constants/decoding';

export const getCountryCodes = (lang: string) => (dispatch) => {
  return VocabularyService
    .decode3166Alpha3Terms(lang)
    .then((codes) => {
      dispatch({
        type: RECEIVE_COUNTRY_CODES_DECODED,
        payload: codes,
      });
    })
    .catch((e) => {
      console.log('Loading country codes decoding failed: ', e);
    })
};