fix: bing dict
This commit is contained in:
@@ -140,7 +140,7 @@ export const apiMicrosoftDict = async (text) => {
|
|||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const doc = parser.parseFromString(str, "text/html");
|
const doc = parser.parseFromString(str, "text/html");
|
||||||
|
|
||||||
const word = doc.querySelector("#headword > h1").textContent.trim();
|
const word = doc.querySelector("#headword > h1")?.textContent.trim();
|
||||||
if (!word) {
|
if (!word) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function DictBody({ text, setCopyText, setRealWord, dict }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <Typography>Empty result</Typography>;
|
return <Typography>Not found!</Typography>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user