Don't include failed translations

This commit is contained in:
dangered wolf 2022-07-25 23:52:38 -04:00
parent f95ffb0393
commit 2652861cd7
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58

View file

@ -123,11 +123,13 @@ const populateTweetProperties = async (
conversation.guestToken || '',
language
);
apiTweet.translation = {
text: translateAPI?.translation || '',
source_lang: translateAPI?.sourceLanguage || '',
target_lang: translateAPI?.destinationLanguage || ''
};
if (translateAPI !== null) {
apiTweet.translation = {
text: translateAPI?.translation || '',
source_lang: translateAPI?.sourceLanguage || '',
target_lang: translateAPI?.destinationLanguage || ''
};
}
}
return apiTweet;