improvements

This commit is contained in:
daniel31x13
2023-12-13 06:59:36 -05:00
parent ca3eb29c48
commit a001f70b9d
11 changed files with 138 additions and 69 deletions
+3 -10
View File
@@ -21,6 +21,7 @@ import {
import useModalStore from "@/store/modals";
import { useSession } from "next-auth/react";
import useLocalSettingsStore from "@/store/localSettings";
import { readabilityAvailable } from "@/lib/shared/getArchiveValidity";
type LinkContent = {
title: string;
@@ -66,11 +67,7 @@ export default function Index() {
useEffect(() => {
const fetchLinkContent = async () => {
if (
router.query.id &&
link?.readabilityPath &&
link?.readabilityPath !== "pending"
) {
if (router.query.id && readabilityAvailable(link)) {
const response = await fetch(
`/api/v1/archives/${link?.id}?format=${ArchivedFormat.readability}`
);
@@ -86,11 +83,7 @@ export default function Index() {
useEffect(() => {
let interval: any;
if (
link?.screenshotPath === "pending" ||
link?.pdfPath === "pending" ||
link?.readabilityPath === "pending"
) {
if (link?.readabilityPath === "pending") {
interval = setInterval(() => getLink(link.id as number), 5000);
} else {
if (interval) {