File size: 514 Bytes
b59aa07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { useQuery } from "@tanstack/react-query";
import { SecretsService } from "#/api/secrets-service";
import { useUserProviders } from "../use-user-providers";
import { useConfig } from "./use-config";

export const useGetSecrets = () => {
  const { data: config } = useConfig();
  const { providers } = useUserProviders();

  const isOss = config?.APP_MODE === "oss";

  return useQuery({
    queryKey: ["secrets"],
    queryFn: SecretsService.getSecrets,
    enabled: isOss || providers.length > 0,
  });
};