@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
20 lines • 834 B
JavaScript
import { useCallback } from "react";
import useProject from "../projects/useProject";
import useAxiosPrivate from "../../config/useAxiosPrivate";
function useFetchSpaceMembers() {
const { projectId } = useProject();
const axios = useAxiosPrivate();
const fetchSpaceMembers = useCallback(async ({ spaceId, page, limit, role, status }) => {
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}/members`, { params: { page, limit, role, status } });
return response.data;
}, [projectId, axios]);
return fetchSpaceMembers;
}
export default useFetchSpaceMembers;
//# sourceMappingURL=useFetchSpaceMembers.js.map