From 76458384624aa16abb1d55e16c7a82329dee197a Mon Sep 17 00:00:00 2001
From: Tore Brede <Tore.Brede@uib.no>
Date: Mon, 13 Dec 2021 12:29:00 +0100
Subject: [PATCH] GREG-139: Clearing error message on back

---
 frontend/public/locales/en/common.json       | 2 +-
 frontend/public/locales/nb/common.json       | 2 +-
 frontend/public/locales/nn/common.json       | 2 +-
 frontend/src/routes/guest/register/index.tsx | 3 +++
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json
index acc8e560..6187593e 100644
--- a/frontend/public/locales/en/common.json
+++ b/frontend/public/locales/en/common.json
@@ -156,7 +156,7 @@
     "errorStatusCode": "Status code: {{statusCode}} (<3>{{statusText}}</3>)",
     "genericServerErrorBody": "The server reported:<1>{{errorBodyText}}</1>",
     "contactHelp": "Contact help through the link in the footer if the problem persists.",
-    "unknown": "An unknown error has occurred. If the problem persists, contact support."
+    "unknown": "An unknown error has occurred. If the problem persists, contact support.",
     "contactHelp": "Contact help through the link in the footer if the problem persists.",
     "invitationDataFetchFailed": "Failed to fetch invitation data",
     "guestRegistrationFailed": "Failed to register your data",
diff --git a/frontend/public/locales/nb/common.json b/frontend/public/locales/nb/common.json
index b776716a..4d1855ff 100644
--- a/frontend/public/locales/nb/common.json
+++ b/frontend/public/locales/nb/common.json
@@ -156,7 +156,7 @@
     "errorStatusCode": "Statuskode: {{statusCode}} (<3>{{statusText}}</3>)",
     "genericServerErrorBody": "Respons fra server:<1>{{errorBodyText}}</1>",
     "contactHelp": "Kontakt hjelp via link i footer om problemet vedvarer.",
-    "unknown": "En ukjent feil har oppstått. Om problemet vedvarer, kontakt brukerstøtte."
+    "unknown": "En ukjent feil har oppstått. Om problemet vedvarer, kontakt brukerstøtte.",
     "contactHelp": "Kontakt hjelp via link i footer om problemet vedvarer.",
     "invitationDataFetchFailed": "Klarte ikke å hente invitasjonsdata",
     "guestRegistrationFailed": "Klarte ikke å registrere dataene dine",
diff --git a/frontend/public/locales/nn/common.json b/frontend/public/locales/nn/common.json
index 0940062b..23ad489b 100644
--- a/frontend/public/locales/nn/common.json
+++ b/frontend/public/locales/nn/common.json
@@ -157,7 +157,7 @@
     "errorStatusCode": "Statuskode: {{statusCode}} (<3>{{statusText}}</3>)",
     "genericServerErrorBody": "Respons frå server:<1>{{errorBodyText}}</1>",
     "contactHelp": "Kontakt hjelp via link i footer om problemet vedvarer.",
-    "unknown": "Ein uventa feil oppstod. Om problemet varer ved, kontakt brukarstøtte."
+    "unknown": "Ein uventa feil oppstod. Om problemet varer ved, kontakt brukarstøtte.",,
     "contactHelp": "Kontakt hjelp via link i footer om problemet vedvarer.",
     "invitationDataFetchFailed": "Klarte ikkje å hente invitasjonsdata",
     "guestRegistrationFailed": "Klarte ikkje å registrere dataene dine",
diff --git a/frontend/src/routes/guest/register/index.tsx b/frontend/src/routes/guest/register/index.tsx
index fd46c9fd..04348238 100644
--- a/frontend/src/routes/guest/register/index.tsx
+++ b/frontend/src/routes/guest/register/index.tsx
@@ -210,6 +210,8 @@ export default function GuestRegister() {
   const handleBack = () => {
     if (activeStep === Step.ConsentStep) {
       setActiveStep(Step.RegisterStep)
+      // Clear error if any
+      setSubmitGuestDataError(null)
     }
   }
 
@@ -276,6 +278,7 @@ export default function GuestRegister() {
       .then((response) => {
         if (response.ok) {
           setActiveStep(Step.SuccessStep)
+          setSubmitGuestDataError(null)
         } else {
           // Expect that the error will contain JSON-data in the body
           // and that there will be a code field there
-- 
GitLab