import * as ScrollArea from "@radix-ui/react-scroll-area"; import { Container } from "@radix-ui/themes"; import { useQuery } from "@tanstack/react-query"; import { GetRandomPostsRow } from "../../@types/PostTypes"; import { axiosLocalhost } from "../../api/axios/axios"; import PostCard from "./PostCard/PostCard"; const LIMIT = 10; export default function RandomPostsPage() { const { data, refetch } = useQuery({ queryKey: ["random_posts_key"], queryFn: async () => { try { const response = await axiosLocalhost.get( `/posts/random?limit=${LIMIT}` ); return response.data as GetRandomPostsRow[]; } catch (error) { console.log(`Something went wrong`); } return []; }, }); return ( <> {data?.map((post, i) => { return ( ); })} ); }