synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
31 lines (30 loc) • 787 B
JavaScript
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