fix(web): fix ghost video component

Signed-off-by: Hanif Dwy Putra S <hanifdwyputrasembiring@gmail.com>
This commit is contained in:
Hanif Dwy Putra S
2022-08-12 13:30:28 +00:00
parent 67debcd265
commit e2302be434
2 changed files with 4 additions and 9 deletions

View File

@@ -7,7 +7,6 @@ export const Footer = () => (
<a
target="_blank"
href="https://github.com/hansputera/tiktok-dl.git"
className="text-gray-800 font-sans"
>
TikTok-DL Project
</a>

View File

@@ -27,7 +27,6 @@ interface StateData {
submitted: boolean;
error?: string | Error;
url: string;
wasSubmit: boolean;
}
const fetcher: Fetcher<ExtractedInfoWithProvider, string> = (...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
</p>
)}
{data && data && data.video && data.video.urls.length && (
{data && data.video && data.video.urls.length && (
<VideoComponent data={data} />
)}
</section>