UNPKG

@replyke/core

Version:

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

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