From e2302be43436d0a02e8a255bdc94ccb987b5203f Mon Sep 17 00:00:00 2001
From: Hanif Dwy Putra S
Date: Fri, 12 Aug 2022 13:30:28 +0000
Subject: [PATCH] fix(web): fix ghost video component
Signed-off-by: Hanif Dwy Putra S
---
apps/web/components/Footer.tsx | 1 -
apps/web/components/FormInput.tsx | 12 ++++--------
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/apps/web/components/Footer.tsx b/apps/web/components/Footer.tsx
index d7ca7c7..788ae67 100644
--- a/apps/web/components/Footer.tsx
+++ b/apps/web/components/Footer.tsx
@@ -7,7 +7,6 @@ export const Footer = () => (
TikTok-DL Project
diff --git a/apps/web/components/FormInput.tsx b/apps/web/components/FormInput.tsx
index b61962a..a532a90 100644
--- a/apps/web/components/FormInput.tsx
+++ b/apps/web/components/FormInput.tsx
@@ -27,7 +27,6 @@ interface StateData {
submitted: boolean;
error?: string | Error;
url: string;
- wasSubmit: boolean;
}
const fetcher: Fetcher = (...args) =>
@@ -42,12 +41,9 @@ export const FormInputComponent = (): JSX.Element => {
submitted: false,
error: undefined,
url: '',
- wasSubmit: false,
});
-
const {data, mutate} = useSWR(
- (state.submitted || state.wasSubmit) &&
- (!state.error || !(state.error as string).length) &&
+ (!state.error || !(state.error as string).length) &&
/^http(s?)(:\/\/)([a-z]+\.)*tiktok\.com\/(.+)$/gi.test(state.url)
? [
'/api/download',
@@ -59,8 +55,8 @@ export const FormInputComponent = (): JSX.Element => {
: null,
fetcher,
{
- loadingTimeout: 10_000,
- refreshInterval: 30_000,
+ loadingTimeout: 5_000,
+ refreshInterval: 60_000,
revalidateOnMount: false,
onSuccess: () =>
setState({
@@ -179,7 +175,7 @@ export const FormInputComponent = (): JSX.Element => {
Wait a minute
)}
- {data && data && data.video && data.video.urls.length && (
+ {data && data.video && data.video.urls.length && (
)}