(cid: string)
| 8 | import { AutoResizeHeight } from '../shared/AutoResizeHeight' |
| 9 | |
| 10 | const 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 | |
| 33 | export const XLogSummaryAsync = async ( |
| 34 | props: ComponentType<{ |
no test coverage detected