Chore: Migrate REST API - saveAutoTranslate to Typescript (#3892)
This commit is contained in:
parent
4666bdf9d5
commit
b9967fda9f
|
@ -734,8 +734,17 @@ export const getDirectory = ({
|
||||||
sort
|
sort
|
||||||
});
|
});
|
||||||
|
|
||||||
export const saveAutoTranslate = ({ rid, field, value, options }: { rid: string; field: string; value: any; options: any }) =>
|
export const saveAutoTranslate = ({
|
||||||
sdk.methodCallWrapper('autoTranslate.saveSettings', rid, field, value, options);
|
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');
|
export const getSupportedLanguagesAutoTranslate = () => sdk.methodCallWrapper('autoTranslate.getSupportedLanguages', 'en');
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,10 @@ class AutoTranslateView extends React.Component<IAutoTranslateViewProps, any> {
|
||||||
saveAutoTranslateLanguage = async (language: string) => {
|
saveAutoTranslateLanguage = async (language: string) => {
|
||||||
logEvent(events.AT_SET_LANG);
|
logEvent(events.AT_SET_LANG);
|
||||||
try {
|
try {
|
||||||
// TODO: remove the parameter options, after migrate the RocketChat
|
|
||||||
await RocketChat.saveAutoTranslate({
|
await RocketChat.saveAutoTranslate({
|
||||||
rid: this.rid,
|
rid: this.rid,
|
||||||
field: 'autoTranslateLanguage',
|
field: 'autoTranslateLanguage',
|
||||||
value: language,
|
value: language
|
||||||
options: null
|
|
||||||
});
|
});
|
||||||
this.setState({ selectedLanguage: language });
|
this.setState({ selectedLanguage: language });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue