fix deleting a key on ui

This commit is contained in:
Ishaan Jaff 2024-04-03 18:33:16 -07:00
parent 79be7239a2
commit 4795fced10

View file

@ -299,13 +299,19 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
const handleDelete = async (token: string) => { const handleDelete = async (token: any) => {
console.log("handleDelete:", token);
if (token.token == null) {
if (token.token_id !== null) {
token.token = token.token_id;
}
}
if (data == null) { if (data == null) {
return; return;
} }
// Set the key to delete and open the confirmation modal // Set the key to delete and open the confirmation modal
setKeyToDelete(token); setKeyToDelete(token.token);
localStorage.removeItem("userData" + userID); localStorage.removeItem("userData" + userID);
setIsDeleteModalOpen(true); setIsDeleteModalOpen(true);
}; };
@ -597,7 +603,7 @@ const handleEditSubmit = async (formValues: Record<string, any>) => {
onClick={() => handleEditClick(item)} onClick={() => handleEditClick(item)}
/> />
<Icon <Icon
onClick={() => handleDelete(item.token)} onClick={() => handleDelete(item)}
icon={TrashIcon} icon={TrashIcon}
size="sm" size="sm"
/> />