fix some react errors

This commit is contained in:
HF 2022-07-11 18:01:01 +02:00
parent 4dca37e67a
commit 4182f1a6e3
2 changed files with 13 additions and 10 deletions

View File

@ -54,7 +54,7 @@ const Captcha = ({ autoload, width }) => {
setCaptchaData({ url: svgUrl, id: captchaid });
};
useEffect(async () => {
useEffect(() => {
if (autoload) {
reloadCaptcha();
}

View File

@ -16,16 +16,19 @@ function getUserFromUrl(url) {
const TikTok = ({ url }) => {
const [embedCode, setEmbedCode] = useState(null);
useEffect(async () => {
const prot = window.location.protocol.startsWith('http')
? window.location.protocol : 'https';
// eslint-disable-next-line max-len
const tkurl = `${prot}//www.tiktok.com/oembed?url=${encodeURIComponent(url)}`;
const resp = await fetch(tkurl);
const embedData = await resp.json();
if (embedData.html) {
setEmbedCode(embedData.html);
useEffect(() => {
async function fetchData() {
const prot = window.location.protocol.startsWith('http')
? window.location.protocol : 'https';
// eslint-disable-next-line max-len
const tkurl = `${prot}//www.tiktok.com/oembed?url=${encodeURIComponent(url)}`;
const resp = await fetch(tkurl);
const embedData = await resp.json();
if (embedData.html) {
setEmbedCode(embedData.html);
}
}
fetchData();
}, []);
if (!embedCode) {