fix rename editing

pull/2277/head
Agusti Fernandez Pardo 2022-04-13 19:32:25 +02:00
parent b3c33b3392
commit 62aa37d51c
1 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ export default function ApiKeyListContainer() {
const [newApiKeyModal, setNewApiKeyModal] = useState(false); const [newApiKeyModal, setNewApiKeyModal] = useState(false);
const [editModalOpen, setEditModalOpen] = useState(false); const [editModalOpen, setEditModalOpen] = useState(false);
const [editing, setEditing] = useState<TApiKeys | null>(null); const [apiKeyToEdit, setApiKeyToEdit] = useState<TApiKeys | null>(null);
return ( return (
<QueryCell <QueryCell
query={query} query={query}
@ -43,7 +43,7 @@ export default function ApiKeyListContainer() {
key={item.id} key={item.id}
apiKey={item} apiKey={item}
onEditApiKey={() => { onEditApiKey={() => {
setEditing(item); setApiKeyToEdit(item);
setEditModalOpen(true); setEditModalOpen(true);
}} }}
/> />
@ -60,12 +60,12 @@ export default function ApiKeyListContainer() {
{/* Edit api key dialog */} {/* Edit api key dialog */}
<Dialog open={editModalOpen} onOpenChange={(isOpen) => !isOpen && setEditModalOpen(false)}> <Dialog open={editModalOpen} onOpenChange={(isOpen) => !isOpen && setEditModalOpen(false)}>
<DialogContent> <DialogContent>
{editing && ( {apiKeyToEdit && (
<ApiKeyDialogForm <ApiKeyDialogForm
title={t("edit_api_key")} title={t("edit_api_key")}
key={editing.id} key={apiKeyToEdit.id}
handleClose={() => setEditModalOpen(false)} handleClose={() => setEditModalOpen(false)}
defaultValues={editing} defaultValues={apiKeyToEdit}
/> />
)} )}
</DialogContent> </DialogContent>