UNPKG

@replyke/core

Version:

Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.

25 lines 928 B
import { useCallback } from "react"; import useProject from "../projects/useProject"; import useAxiosPrivate from "../../config/useAxiosPrivate"; function useFetchEntityByShortId() { const axios = useAxiosPrivate(); const { projectId } = useProject(); const fetchEntityByShortId = useCallback(async ({ shortId, include }) => { if (!projectId) { throw new Error("No projectId available."); } if (!shortId) { throw new Error("Please pass shortId"); } const response = await axios.get(`/${projectId}/entities/by-short-id`, { params: { shortId, include: Array.isArray(include) ? include.join(",") : include, }, }); return response.data; }, [projectId]); return fetchEntityByShortId; } export default useFetchEntityByShortId; //# sourceMappingURL=useFetchEntityByShortId.js.map