{"version":3,"file":"article-list-by-topic-Qrr6Hqfs.js","sources":["../../src/components/article-list-by-topic.js"],"sourcesContent":["import { defineComponent } from 'vue'\r\nimport { useInfiniteQuery } from '@tanstack/vue-query'\r\n\r\nexport default defineComponent({\r\n setup(props) {\r\n const {\r\n data,\r\n error,\r\n fetchNextPage,\r\n hasNextPage,\r\n isFetchingNextPage,\r\n isError\r\n } = useInfiniteQuery({\r\n initialPageParam: props.initialPage,\r\n queryKey: ['news'],\r\n queryFn: async ({ pageParam }) => {\r\n const res = await fetch(`/api/tagquery/getblogs?topic=${props.topic}&itemsperpage=${props.pageSize}&pagenumber=${pageParam}`)\r\n const json = await res.json()\r\n if (json.errorOccurred) throw new Error(json.errorMessage)\r\n return json\r\n },\r\n enabled: false, // otherwise TanStack tries to fetch on mount,\r\n getNextPageParam: (lastPage, _, lastPageParam) =>\r\n lastPage?.hasMoreRecords && lastPageParam != null ? lastPageParam + 1 : undefined\r\n })\r\n\r\n return {\r\n data,\r\n isError,\r\n error,\r\n fetchNextPage,\r\n hasNextPage,\r\n isFetchingNextPage\r\n }\r\n },\r\n props: {\r\n initialPage: Number,\r\n pageSize: Number,\r\n topic: String\r\n }\r\n})"],"names":["articleListByTopic","defineComponent","props","data","error","fetchNextPage","hasNextPage","isFetchingNextPage","isError","useInfiniteQuery","pageParam","json","lastPage","_","lastPageParam"],"mappings":"0FAGA,MAAAA,EAAeC,EAAgB,CAC3B,MAAMC,EAAO,CACT,KAAM,CACF,KAAAC,EACA,MAAAC,EACA,cAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,QAAAC,CACH,EAAGC,EAAiB,CACjB,iBAAkBP,EAAM,YACxB,SAAU,CAAC,MAAM,EACjB,QAAS,MAAO,CAAE,UAAAQ,KAAgB,CAE9B,MAAMC,EAAO,MADD,MAAM,MAAM,gCAAgCT,EAAM,KAAK,iBAAiBA,EAAM,QAAQ,eAAeQ,CAAS,EAAE,GACrG,KAAM,EAC7B,GAAIC,EAAK,cAAe,MAAM,IAAI,MAAMA,EAAK,YAAY,EACzD,OAAOA,CACV,EACD,QAAS,GACT,iBAAkB,CAACC,EAAUC,EAAGC,IAC5BF,GAAA,MAAAA,EAAU,gBAAkBE,GAAiB,KAAOA,EAAgB,EAAI,MACxF,CAAS,EAED,MAAO,CACH,KAAAX,EACA,QAAAK,EACA,MAAAJ,EACA,cAAAC,EACA,YAAAC,EACA,mBAAAC,CACH,CACJ,EACD,MAAO,CACH,YAAa,OACb,SAAU,OACV,MAAO,MACV,CACL,CAAC"}