import { GET_SIDEBAR_BADGE_ROUTE } from "@/core/utils/routes";
import useSWR from "swr";
import useRequest from "./useRequest";

export const useSidebarBadge = () => {
    const request = useRequest();

    const fetcher = async (url) => {
        try {
            const response = await request(url);
            return response.data;
        } catch (error) {
            throw new Error();
        }
    };

    return useSWR(GET_SIDEBAR_BADGE_ROUTE, fetcher, { keepPreviousData: true });
};
