import { useFetcher } from 'react-router'; import Dialog from '~/components/Dialog'; import Spinner from '~/components/Spinner'; type Properties = { readonly isEnabled: boolean; readonly disabled?: boolean; }; export default function Modal({ isEnabled, disabled }: Properties) { const fetcher = useFetcher(); return ( {fetcher.state === 'idle' ? undefined : } {isEnabled ? 'Disable' : 'Enable'} Magic DNS {(close) => ( <> {isEnabled ? 'Disable' : 'Enable'} Magic DNS Devices will no longer be accessible via your tailnet domain. The search domain will also be disabled.
Cancel { fetcher.submit( { // eslint-disable-next-line @typescript-eslint/naming-convention 'dns.magic_dns': !isEnabled, }, { method: 'PATCH', encType: 'application/json', }, ); close(); }} > {isEnabled ? 'Disable' : 'Enable'} Magic DNS
)}
); }