import React, { FC, useEffect, useState } from 'react'; import { RouteComponentProps } from '@reach/router'; import { Alert, Button } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faSpinner } from '@fortawesome/free-solid-svg-icons'; import CopyToClipboard from 'react-copy-to-clipboard'; import './Config.css'; const Config: FC = () => { const [config, setConfig] = useState(null); const [error, setError] = useState(""); const [copied, setCopied] = useState(false); useEffect(() => { fetch('../api/v1/status/config') .then(res => res.json()) .then(res => setConfig(res.data.yaml)) .catch(error => setError(error.message)); }, []); return ( <>

Configuration  { setCopied(result); setTimeout(setCopied, 1500);}} >

{error ? Error: Error fetching configuration: {error} : config ?
{config}
: } ) } export default Config;