Skip to content

Commit

Permalink
Merge pull request #883 from OpenSignLabs/raktima-opensignlabs-patch-10
Browse files Browse the repository at this point in the history
fix: unnecessary showing message faild to load on send document popup
  • Loading branch information
nxglabs authored Jun 26, 2024
2 parents 6d4ebf7 + cd48448 commit cc398d6
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions apps/OpenSign/src/primitives/DotLottieReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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>
Expand Down

0 comments on commit cc398d6

Please sign in to comment.