feat(opendock): added in new article link setup for fine tuning how od works

This commit is contained in:
2026-05-23 11:22:02 -05:00
parent 3a27fd8542
commit 389211186f
24 changed files with 3903 additions and 72 deletions

View File

@@ -0,0 +1,25 @@
import { keepPreviousData, queryOptions } from "@tanstack/react-query";
import { api } from "../apiHelper";
export function getArticleLinks() {
return queryOptions({
queryKey: ["getArticleLinks"],
queryFn: () => dataFetch(),
staleTime: 5000,
refetchOnWindowFocus: true,
placeholderData: keepPreviousData,
});
}
const dataFetch = async () => {
if (window.location.hostname === "localhost") {
await new Promise((res) => setTimeout(res, 1500));
}
const { data } = await api.get("/opendock/articleCheck");
if (!data.success) {
throw new Error(data.message ?? "Failed to load article links");
}
return data.data ?? [];
};