@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
22 lines • 835 B
JavaScript
import { useCallback } from "react";
import useProject from "../projects/useProject";
import useAxiosPrivate from "../../config/useAxiosPrivate";
// Fetches all admins and moderators of a space (no pagination)
function useFetchSpaceTeam() {
const { projectId } = useProject();
const axios = useAxiosPrivate();
const fetchSpaceTeam = useCallback(async ({ spaceId }) => {
if (!projectId) {
throw new Error("No projectId available.");
}
if (!spaceId) {
throw new Error("Please pass a spaceId");
}
const url = `/${projectId}/spaces/${spaceId}/team`;
const response = await axios.get(url);
return response.data;
}, [projectId, axios]);
return fetchSpaceTeam;
}
export default useFetchSpaceTeam;
//# sourceMappingURL=useFetchSpaceTeam.js.map