import { useParams } from 'common' import { useState } from 'react' import { Button, Modal } from 'ui' import Table from 'components/to-be-cleaned/Table' import AlertError from 'components/ui/AlertError' import ConfirmationModal from 'components/ui/ConfirmationModal' import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' import { useSecretsDeleteMutation } from 'data/secrets/secrets-delete-mutation' import { ProjectSecret, useSecretsQuery } from 'data/secrets/secrets-query' import { useStore } from 'hooks' import AddNewSecretModal from './AddNewSecretModal' import EdgeFunctionSecret from './EdgeFunctionSecret' const EdgeFunctionSecrets = () => { const { ui } = useStore() const { ref: projectRef } = useParams() const [showCreateSecret, setShowCreateSecret] = useState(false) const [selectedSecret, setSelectedSecret] = useState() const { data: secrets, error, isLoading, isSuccess, isError, } = useSecretsQuery({ projectRef: projectRef ?? '', }) const { mutate: deleteSecret, isLoading: isDeleting } = useSecretsDeleteMutation({ onSuccess: () => { ui.setNotification({ category: 'success', message: `Successfully deleted ${selectedSecret?.name}`, }) setSelectedSecret(undefined) }, }) return ( <>

Edge Function Secrets Management

Manage the secrets for your project's edge functions
{isLoading && } {isError && } {isSuccess && ( Name , Value,
, ]} body={secrets?.map((secret) => ( setSelectedSecret(secret)} /> ))} /> )} setShowCreateSecret(false)} /> setSelectedSecret(undefined)} onSelectConfirm={() => { if (selectedSecret !== undefined) { deleteSecret({ projectRef, secrets: [selectedSecret.name] }) } }} >

Before removing this secret, do ensure that none of your edge functions are currently actively using this secret. This action cannot be undone.

) } export default EdgeFunctionSecrets