mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
20 lines
680 B
TypeScript
20 lines
680 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { SecretsService } from "#/api/secrets-service";
|
|
import { useConfig } from "./use-config";
|
|
import { useIsAuthed } from "#/hooks/query/use-is-authed";
|
|
import { useSelectedOrganizationId } from "#/context/use-selected-organization";
|
|
|
|
export const useGetSecrets = () => {
|
|
const { data: config } = useConfig();
|
|
const { data: isAuthed } = useIsAuthed();
|
|
const { organizationId } = useSelectedOrganizationId();
|
|
|
|
const isOss = config?.app_mode === "oss";
|
|
|
|
return useQuery({
|
|
queryKey: ["secrets", organizationId],
|
|
queryFn: SecretsService.getSecrets,
|
|
enabled: isOss || (isAuthed && !!organizationId),
|
|
});
|
|
};
|