optimize some code

This commit is contained in:
Gabe Yuan
2023-08-03 10:23:40 +08:00
parent f31531e558
commit fbfd68fea2
11 changed files with 19 additions and 20 deletions

View File

@@ -3,8 +3,6 @@ import { useState } from "react";
import { apiTranslate } from "../apis";
import browser from "../libs/browser";
import {
TRANS_MIN_LENGTH,
TRANS_MAX_LENGTH,
MSG_TRANS_PUTRULE,
DEFAULT_FETCH_LIMIT,
MSG_FETCH_LIMIT,
@@ -47,11 +45,6 @@ export function useTranslate(q, initRule) {
useEffect(() => {
(async () => {
// 太长或太短不翻译
if (q.length < TRANS_MIN_LENGTH || q.length > TRANS_MAX_LENGTH) {
return;
}
try {
setLoading(true);
const deLang = await detectLang(q);