Skip to content

Commit

Permalink
add async function on delete list
Browse files Browse the repository at this point in the history
  • Loading branch information
ocsiddisco committed May 15, 2024
1 parent 70e1d9a commit 99f6d30
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/DeleteList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ const DeleteList = ({ user, email, listPath, listName, setListPath }) => {
const [open, setOpen] = useState(false);
const [submitted, setSubmitted] = useState(false);

const handleDelete = (user, email, listPath, listName) => {
const handleDelete = async (user, email, listPath, listName) => {
setSubmitted(true);
deleteList(user, email, listPath, listName);
setListPath('');
setSubmitted((prevSubmitted) => !prevSubmitted);
setOpen((prevOpen) => !prevOpen);
try {
await deleteList(user, email, listPath, listName);
setListPath('');
} catch (error) {
console.log(error);
}
return;
};

Expand Down

0 comments on commit 99f6d30

Please sign in to comment.