UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

31 lines (30 loc) 787 B
import { useQuery as o, useQueryClient as a } from "@tanstack/react-query"; import { getOrganization as u, searchRegistry as y } from "../../ror-client/index.js"; function f(r, e) { return o({ staleTime: 1 / 0, ...e, queryKey: ["ror", "organization", r], queryFn: () => u(r) }); } function h(r, e) { const s = a(); return o({ staleTime: 1 / 0, ...e, queryKey: ["ror", "search", r], queryFn: async () => { const i = await y(r); return i.items.forEach((n) => { let t = n.id; t.startsWith("https://ror.org/") && (t = t.split("https://ror.org/")[1]), s.setQueryData(["ror", "organization", t], n); }), i; } }); } export { f as useGetOrganization, h as useSearchRegistry }; //# sourceMappingURL=index.js.map