@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
27 lines • 1.14 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const useProject_1 = __importDefault(require("../projects/useProject"));
const useAxiosPrivate_1 = __importDefault(require("../../config/useAxiosPrivate"));
// Fetches all admins and moderators of a space (no pagination)
function useFetchSpaceTeam() {
const { projectId } = (0, useProject_1.default)();
const axios = (0, useAxiosPrivate_1.default)();
const fetchSpaceTeam = (0, react_1.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;
}
exports.default = useFetchSpaceTeam;
//# sourceMappingURL=useFetchSpaceTeam.js.map