From a217e067abcadc9eab15e41b43d009cb12de12dd Mon Sep 17 00:00:00 2001
From: Tore Brede <Tore.Brede@uib.no>
Date: Mon, 13 Dec 2021 11:21:08 +0100
Subject: [PATCH] The submitState state is not used, so removing it

---
 frontend/src/routes/guest/register/index.tsx | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/frontend/src/routes/guest/register/index.tsx b/frontend/src/routes/guest/register/index.tsx
index cd2d443f..fd46c9fd 100644
--- a/frontend/src/routes/guest/register/index.tsx
+++ b/frontend/src/routes/guest/register/index.tsx
@@ -25,12 +25,6 @@ import ServerErrorReport, {
   ErrorReportProps,
 } from '../../../components/errorReport'
 
-enum SubmitState {
-  NotSubmitted,
-  Submitted,
-  SubmittedError,
-}
-
 enum Step {
   RegisterStep,
   ConsentStep,
@@ -75,11 +69,6 @@ export default function GuestRegister() {
 
   const guestRegisterRef = useRef<GuestRegisterCallableMethods>(null)
   const guestConsentRef = useRef<GuestRegisterCallableMethods>(null)
-
-  // eslint-disable-next-line @typescript-eslint/no-unused-vars
-  const [submitState, setSubmitState] = useState<SubmitState>(
-    SubmitState.NotSubmitted
-  )
   const [activeStep, setActiveStep] = useState(0)
 
   const [initialGuestData, setInitialGuestData] =
@@ -286,7 +275,6 @@ export default function GuestRegister() {
     fetch('/api/ui/v1/invited/', submitJsonOpts('POST', payload))
       .then((response) => {
         if (response.ok) {
-          setSubmitState(SubmitState.Submitted)
           setActiveStep(Step.SuccessStep)
         } else {
           // Expect that the error will contain JSON-data in the body
@@ -313,9 +301,6 @@ export default function GuestRegister() {
                 errorBodyText: undefined,
               })
             })
-            .finally(() => {
-              setSubmitState(SubmitState.SubmittedError)
-            })
         }
       })
       .catch((error) => {
@@ -326,7 +311,6 @@ export default function GuestRegister() {
           statusText: undefined,
           errorBodyText: undefined,
         })
-        setSubmitState(SubmitState.SubmittedError)
         console.error(error)
       })
   }
-- 
GitLab