UNPKG

@replyke/core

Version:

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

24 lines 853 B
import { useCallback } from "react"; import useProject from "../projects/useProject"; import useAxiosPrivate from "../../config/useAxiosPrivate"; function useFetchSpace() { const { projectId } = useProject(); const axios = useAxiosPrivate(); const fetchSpace = useCallback(async ({ spaceId, include, }) => { if (!projectId) { throw new Error("No projectId available."); } if (!spaceId) { throw new Error("Please pass a spaceId"); } const response = await axios.get(`/${projectId}/spaces/${spaceId}`, { params: { include: Array.isArray(include) ? include.join(",") : include, }, }); return response.data; }, [projectId]); return fetchSpace; } export default useFetchSpace; //# sourceMappingURL=useFetchSpace.js.map