pull/5370/head
Defi Boy 4 years ago committed by Joseph Izang
parent d7658a3dbe
commit 08e7adb6e6
  1. 27
      src/views/HomeView.tsx

@ -12,7 +12,7 @@ export const HomeView: React.FC = () => {
const clearMessageFuncRef = useRef(undefined as any); const clearMessageFuncRef = useRef(undefined as any);
useEffect(() => { useEffect(() => {
let maxNumberOfRetries = 1; const maxNumberOfRetries = 1;
let retries = 0; let retries = 0;
const publishDocumentation = async () => { const publishDocumentation = async () => {
@ -29,22 +29,22 @@ export const HomeView: React.FC = () => {
window.open(url); window.open(url);
} catch (error) { } catch (error) {
if (retries < maxNumberOfRetries) { if (retries < maxNumberOfRetries) {
console.log("Retrying...") console.log("Retrying...");
retries++; retries++;
publishDocumentation() publishDocumentation();
} else { } else {
setIsPublishing(false); setIsPublishing(false);
setHasErrorOnPublishing(true) setHasErrorOnPublishing(true);
clearMessageFuncRef.current = setTimeout(() => { clearMessageFuncRef.current = setTimeout(() => {
setHasErrorOnPublishing(false) setHasErrorOnPublishing(false);
}, 5000); }, 5000);
} }
} }
} };
if (isPublishing) { if (isPublishing) {
setHasErrorOnPublishing(false) setHasErrorOnPublishing(false);
publishDocumentation(); publishDocumentation();
} }
}, [isPublishing, htmlDocumentation]); }, [isPublishing, htmlDocumentation]);
@ -121,10 +121,11 @@ export const HomeView: React.FC = () => {
)} )}
</div> </div>
{hasErrorOnPublishing && {hasErrorOnPublishing && (
<div> <div>
<label>Something unexpected happen, Please try again</label> <label>Something unexpected happen, Please try again</label>
</div>} </div>
)}
</div> </div>
)} )}
</div> </div>
@ -152,7 +153,13 @@ export const PublishButton: React.FC<PublishButtonProps> = ({
{!isPublishing && "Publish"} {!isPublishing && "Publish"}
{isPublishing && ( {isPublishing && (
<div style={{ display: "flex", justifyContent: "center", alignItems: "center" }}> <div
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<span <span
className="spinner-border spinner-border-sm" className="spinner-border spinner-border-sm"
role="status" role="status"

Loading…
Cancel
Save