Skip to content

Commit

Permalink
Merge pull request #79 from the-collab-lab/ce-bugDelete
Browse files Browse the repository at this point in the history
fix bug on delete list
  • Loading branch information
ocsiddisco committed May 22, 2024
2 parents 1f8d279 + 51abfa0 commit 1a4c9c2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/DeleteList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ 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('');
try {
await deleteList(user, email, listPath, listName);
setSubmitted((prevSubmitted) => !prevSubmitted);
setOpen((prevOpen) => !prevOpen);
setListPath('');
} catch (error) {
setSubmitted(false);
console.log(error);
}
return;
};

Expand Down

0 comments on commit 1a4c9c2

Please sign in to comment.