@replyke/core
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
29 lines • 1.15 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 axios_1 = __importDefault(require("../../../config/axios"));
function useFetchFollowingByUserId() {
const { projectId } = (0, useProject_1.default)();
const fetchFollowingByUserId = (0, react_1.useCallback)(async ({ userId, page = 1, limit = 20 }) => {
if (!userId) {
throw new Error("No userId provided.");
}
if (!projectId) {
throw new Error("No projectId available.");
}
const response = await axios_1.default.get(`/${projectId}/users/${userId}/following`, {
params: {
page,
limit,
},
});
return response.data;
}, [projectId]);
return fetchFollowingByUserId;
}
exports.default = useFetchFollowingByUserId;
//# sourceMappingURL=useFetchFollowingByUserId.js.map