UNPKG

@replyke/core

Version:

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

29 lines 1.21 kB
"use strict"; 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 useAxiosPrivate_1 = __importDefault(require("../../../config/useAxiosPrivate")); const useProject_1 = __importDefault(require("../../projects/useProject")); const user_1 = require("../../user"); function useFetchFollowers() { const axios = (0, useAxiosPrivate_1.default)(); const { projectId } = (0, useProject_1.default)(); const { user } = (0, user_1.useUser)(); const fetchFollowers = (0, react_1.useCallback)(async ({ page = 1, limit = 20 } = {}) => { if (!projectId) { throw new Error("No projectId available."); } if (!user) { throw new Error("No user is logged in."); } const response = await axios.get(`/${projectId}/follows/followers`, { params: { page, limit }, }); return response.data; }, [axios, projectId, user]); return fetchFollowers; } exports.default = useFetchFollowers; //# sourceMappingURL=useFetchFollowers.js.map