mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-02 22:28:44 +02:00
Merge pull request #883 from OpenSignLabs/raktima-opensignlabs-patch-10
fix: unnecessary showing message faild to load on send document popup
This commit is contained in:
@@ -2,20 +2,13 @@ import React, { useState, useEffect } from "react";
|
||||
import { DotLottieReact } from "@lottiefiles/dotlottie-react";
|
||||
import Loader from "./Loader";
|
||||
|
||||
const LottieWithLoader = ({
|
||||
src = "https://lottie.host/00a72a09-f2d4-493a-9b2d-2843bf067638/Ic7jJ44wLJ.json",
|
||||
minLoaderTime = 1000,
|
||||
timeout = 10000
|
||||
}) => {
|
||||
const LottieWithLoader = () => {
|
||||
const [isLoaded, setIsLoaded] = useState(false);
|
||||
const [hasError, setHasError] = useState(false);
|
||||
const [animationSrc, setAnimationSrc] = useState(null);
|
||||
|
||||
const src =
|
||||
"https://lottie.host/00a72a09-f2d4-493a-9b2d-2843bf067638/Ic7jJ44wLJ.json";
|
||||
useEffect(() => {
|
||||
const timer = setTimeout(() => {
|
||||
setHasError(true);
|
||||
}, timeout);
|
||||
|
||||
fetch(src)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
@@ -26,17 +19,13 @@ const LottieWithLoader = ({
|
||||
.then((blob) => {
|
||||
const objectURL = URL.createObjectURL(blob);
|
||||
setAnimationSrc(objectURL);
|
||||
setTimeout(() => {
|
||||
setIsLoaded(true);
|
||||
}, minLoaderTime);
|
||||
setIsLoaded(true);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("There was a problem with the fetch operation:", error);
|
||||
console.error("faild to load animation of send request:", error);
|
||||
setHasError(true);
|
||||
});
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}, [src, minLoaderTime, timeout]);
|
||||
}, [src]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user