fix some react errors
This commit is contained in:
parent
4dca37e67a
commit
4182f1a6e3
|
@ -54,7 +54,7 @@ const Captcha = ({ autoload, width }) => {
|
|||
setCaptchaData({ url: svgUrl, id: captchaid });
|
||||
};
|
||||
|
||||
useEffect(async () => {
|
||||
useEffect(() => {
|
||||
if (autoload) {
|
||||
reloadCaptcha();
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user