From 870b57611d9a06222467dcbb09f82d6aa8fae1cb Mon Sep 17 00:00:00 2001
From: Max Frederiksen <maxfrederiksen@Maxs-MacBook-Air.local>
Date: Wed, 8 Jan 2025 09:54:51 +0100
Subject: [PATCH] Remove async/await

---
 src/components/IOC/IOCDelete/IOCDelete.jsx | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/components/IOC/IOCDelete/IOCDelete.jsx b/src/components/IOC/IOCDelete/IOCDelete.jsx
index 43d0bf09..ff5f991a 100644
--- a/src/components/IOC/IOCDelete/IOCDelete.jsx
+++ b/src/components/IOC/IOCDelete/IOCDelete.jsx
@@ -31,17 +31,16 @@ export const IOCDelete = ({ ioc, buttonDisabled, setButtonDisabled }) => {
     }
   }, [error, setButtonDisabled]);
 
-  const onConfirm = useCallback(async () => {
+  const onConfirm = useCallback(() => {
     reset();
     setButtonDisabled(true);
-    try {
-      await deleteIOC({ iocId: ioc.id }).unwrap();
-      showSnackBar(`IOC ${ioc.namingName} deleted`, "success");
-      navigate("/iocs", { replace: true });
-    } catch (err) {
-      showSnackBar(getErrorMessage(err), "error");
-      setButtonDisabled(false);
-    }
+    deleteIOC({ iocId: ioc.id })
+      .unwrap()
+      .then(() => {
+        showSnackBar(`IOC ${ioc.namingName} deleted`, "success");
+        navigate("/iocs", { replace: true });
+      })
+      .catch(() => setButtonDisabled(false));
   }, [
     reset,
     setButtonDisabled,
-- 
GitLab