1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-30 18:59:41 +02:00
portainer/app/react/portainer/settings/queries/useSSLSettings.ts

24 lines
585 B
TypeScript

import { useQuery } from 'react-query';
import axios, { parseAxiosError } from '@/portainer/services/axios';
interface SSLSettings {
certPath: string;
keyPath: string;
caCertPath: string;
selfSigned: boolean;
httpEnabled: boolean;
}
export function useSSLSettings() {
return useQuery<SSLSettings>(['sslSettings'], async () => getSSLSettings());
}
async function getSSLSettings() {
try {
const response = await axios.get<SSLSettings>('/ssl');
return response.data;
} catch (error) {
throw parseAxiosError(error, 'Unable to retrieve SSL settings');
}
}