From 36ec9a8df248d65675576b3e112b5a79e6b736cb Mon Sep 17 00:00:00 2001 From: StefanWout Date: Fri, 18 Oct 2024 15:05:59 +0100 Subject: [PATCH] complete the if statement determining if the portfolioName and deleteConfirmationByName match,added some error handling to the handleDeleteConfirmation function --- .../(portfolio)/settings/PortfolioSettings.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/portfolio/[slug]/(portfolio)/settings/PortfolioSettings.tsx b/src/app/portfolio/[slug]/(portfolio)/settings/PortfolioSettings.tsx index 1c7f888..d99da54 100644 --- a/src/app/portfolio/[slug]/(portfolio)/settings/PortfolioSettings.tsx +++ b/src/app/portfolio/[slug]/(portfolio)/settings/PortfolioSettings.tsx @@ -93,8 +93,18 @@ export default function PortfolioSettings({ const [deleteConfirmationByName, setDeleteConfirmationByName] = useState("") function handleDeleteConfirmation() { - // if (deleteConfirmationByName === portfolioName) console.log("we be deletin stuff") + if (deleteConfirmationByName === portfolioName) { + //API call to delete portfolio + //deletePortfolio(portfolioId) + router.refresh(); + setIsDeleteModalOpen(false); + } else { + // Error if the names don't match + console.log("Portfolio name does not match"); + } + } + } // RENAMING FUNCTIONS