MCPcopy
hub / github.com/Innei/Shiro / fetchData

Function fetchData

src/components/modules/xlog/XLogSummaryAsync.tsx:10–31  ·  view source on GitHub ↗
(cid: string)

Source from the content-addressed store, hash-verified

8import { AutoResizeHeight } from '../shared/AutoResizeHeight'
9
10const fetchData = async (cid: string) => {
11 if (!cid) {
12 return null
13 }
14
15 return queryClient.fetchQuery({
16 queryKey: ['xlog', 'summary', cid],
17 staleTime: 6000,
18 gcTime: 6000,
19 queryFn: async () => {
20 const lang =
21 'navigator' in globalThis ? navigator.language.split('-')[0] : 'zh'
22 return fetch(`/api/xlog/summary?cid=${cid}&lang=${lang}`, {
23 next: {
24 revalidate: 60 * 10,
25 },
26 })
27 .then((res) => res.json())
28 .catch(() => null)
29 },
30 })
31}
32
33export const XLogSummaryAsync = async (
34 props: ComponentType<{

Callers 1

RealDataRenderFunction · 0.85

Calls 2

fetchFunction · 0.85
jsonMethod · 0.80

Tested by

no test coverage detected