import React, { useEffect } from 'react'; import ContentBox from '@/components/elements/ContentBox'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import FlashMessageRender from '@/components/FlashMessageRender'; import PageContentBlock from '@/components/elements/PageContentBlock'; import tw from 'twin.macro'; import GreyRowBox from '@/components/elements/GreyRowBox'; import { useSSHKeys } from '@/api/account/ssh-keys'; import { useFlashKey } from '@/plugins/useFlash'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faKey } from '@fortawesome/free-solid-svg-icons'; import { format } from 'date-fns'; import CreateSSHKeyForm from '@/components/dashboard/ssh/CreateSSHKeyForm'; import DeleteSSHKeyButton from '@/components/dashboard/ssh/DeleteSSHKeyButton'; export default () => { const { clearAndAddHttpError } = useFlashKey('account'); const { data, isValidating, error } = useSSHKeys({ revalidateOnMount: true, revalidateOnFocus: false, }); useEffect(() => { clearAndAddHttpError(error); }, [error]); return (
{!data || !data.length ? (

{!data ? 'Loading...' : 'No SSH Keys exist for this account.'}

) : ( data.map((key, index) => ( 0 && tw`mt-2`]} >

{key.name}

SHA256:{key.fingerprint}

Added on:  {format(key.createdAt, 'MMM do, yyyy HH:mm')}

)) )}
); };