fix(translationService): correct API reading

Signed-off-by: Grigory Vodyanov <scratchx@gmx.com>
This commit is contained in:
Grigory Vodyanov 2025-01-16 17:07:34 +01:00
Родитель 789ddfe619
Коммит 19baf3e8b6
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -11,8 +11,15 @@ const fetchAvailableLanguages = async function() {
const mainStore = useMainStore()
try {
const response = await axios.get(generateOcsUrl('taskprocessing/tasktypes'))
const inputLanguages = response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues[0]
const outputLanguages = response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues[1]
let inputLanguages = []
let outputLanguages = []
if (typeof response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues === 'object') {
inputLanguages = response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues.origin_language
outputLanguages = response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues.target_language
} else {
inputLanguages = response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues[0]
outputLanguages = response.data.ocs.data.types['core:text2text:translate'].inputShapeEnumValues[1]
}
mainStore.translationInputLanguages = inputLanguages
mainStore.translationOutputLanguages = outputLanguages
} catch (e) {