| 1 |
import actions from './actions'; |
| 2 |
|
| 3 |
const resolvers = { |
| 4 |
*getSettings() { |
| 5 |
const path = '/beyondwords/v1/settings'; |
| 6 |
const settings = yield actions.fetchFromAPI( path ); |
| 7 |
return actions.setSettings( settings ); |
| 8 |
}, |
| 9 |
*getPlayerStyles( projectId ) { |
| 10 |
if (! projectId) { |
| 11 |
return []; |
| 12 |
} |
| 13 |
const path = `/beyondwords/v1/projects/${projectId}/player-styles`; |
| 14 |
const playerStyles = yield actions.fetchFromAPI( path ); |
| 15 |
return actions.setPlayerStyles( playerStyles ); |
| 16 |
}, |
| 17 |
*getLanguages() { |
| 18 |
const path = '/beyondwords/v1/languages'; |
| 19 |
// const languages = yield actions.fetchFromAPI( path, { filter: '1' } ); |
| 20 |
const languages = yield actions.fetchFromAPI( path ); |
| 21 |
return actions.setLanguages( languages ); |
| 22 |
}, |
| 23 |
*getVoices( languageId ) { |
| 24 |
const path = `/beyondwords/v1/languages/${languageId}/voices`; |
| 25 |
const voices = yield actions.fetchFromAPI( path ); |
| 26 |
return actions.setVoices( voices ); |
| 27 |
}, |
| 28 |
}; |
| 29 |
|
| 30 |
export default resolvers; |
| 31 |
|