fix translate button

This commit is contained in:
fly_mc 2024-10-17 23:46:13 +08:00
parent e9e08b2ec2
commit 246a5c5d48
2 changed files with 10 additions and 6 deletions

View file

@ -67,7 +67,7 @@
"three": "0.169.0",
"throttle-debounce": "5.0.2",
"tinycolor2": "1.6.0",
"tinyld/heavy": "^1.3.4",
"tinyld": "^1.3.4",
"tsc-alias": "1.8.10",
"tsconfig-paths": "4.2.0",
"typescript": "5.6.2",

View file

@ -585,14 +585,18 @@ const isForeignLanguage: boolean = appearNote.value.text != null && (() => {
})();
async function translate(): Promise<void> {
if (props.translation.value != null) return;
props.translating.value = true;
if (translation.value != null) return;
collapsed.value = false;
translating.value = true;
if (props.mock) {
return;
}
const res = await misskeyApi('notes/translate', {
noteId: appearNote.id,
noteId: appearNote.value.id,
targetLang: miLocalStorage.getItem('lang') ?? navigator.language,
});
props.translating.value = false;
props.translation.value = res;
translating.value = false;
translation.value = res;
}
function showRenoteMenu(): void {