Chore: Migrate REST API - saveAutoTranslate to Typescript (#3892)

This commit is contained in:
Alex Junior 2022-03-15 21:54:43 -03:00 committed by GitHub
parent 4666bdf9d5
commit b9967fda9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -734,8 +734,17 @@ export const getDirectory = ({
sort
});
export const saveAutoTranslate = ({ rid, field, value, options }: { rid: string; field: string; value: any; options: any }) =>
sdk.methodCallWrapper('autoTranslate.saveSettings', rid, field, value, options);
export const saveAutoTranslate = ({
rid,
field,
value,
options
}: {
rid: string;
field: string;
value: string;
options?: { defaultLanguage: string };
}) => sdk.methodCallWrapper('autoTranslate.saveSettings', rid, field, value, options ?? null);
export const getSupportedLanguagesAutoTranslate = () => sdk.methodCallWrapper('autoTranslate.getSupportedLanguages', 'en');

View File

@ -97,12 +97,10 @@ class AutoTranslateView extends React.Component<IAutoTranslateViewProps, any> {
saveAutoTranslateLanguage = async (language: string) => {
logEvent(events.AT_SET_LANG);
try {
// TODO: remove the parameter options, after migrate the RocketChat
await RocketChat.saveAutoTranslate({
rid: this.rid,
field: 'autoTranslateLanguage',
value: language,
options: null
value: language
});
this.setState({ selectedLanguage: language });
} catch (error) {