UNPKG

@replyke/core

Version:

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

24 lines 882 B
import { useCallback } from "react"; import useProject from "../projects/useProject"; import axios from "../../config/axios"; function useFetchUserByForeignId() { const { projectId } = useProject(); const fetchUserByForeignId = useCallback(async ({ foreignId, include, }) => { if (!projectId) { throw new Error("No project specified"); } if (!foreignId) { throw new Error("Please specify a foreign ID"); } const response = await axios.get(`/${projectId}/users/by-foreign-id`, { params: { foreignId, include: Array.isArray(include) ? include.join(",") : include, }, }); return response.data; }, [projectId]); return fetchUserByForeignId; } export default useFetchUserByForeignId; //# sourceMappingURL=useFetchUserByForeignId.js.map