diff --git a/frontend/kesaseteli/employer/public/locales/en/common.json b/frontend/kesaseteli/employer/public/locales/en/common.json index a9acf20293..2103f45b60 100644 --- a/frontend/kesaseteli/employer/public/locales/en/common.json +++ b/frontend/kesaseteli/employer/public/locales/en/common.json @@ -68,7 +68,8 @@ "remove_employment": "Delete the information", "fetch_employment": "Load information", "fetch_employment_error_title": "Error occured!", - "fetch_employment_error_message": "Could not fetch the info of the employee." + "fetch_employment_error_message": "Could not fetch the info of the employee.", + "fetch_employment_not_found_error_message": "Employee's information was not found." }, "step3": { "name": "Send", diff --git a/frontend/kesaseteli/employer/public/locales/fi/common.json b/frontend/kesaseteli/employer/public/locales/fi/common.json index 05746f35ca..d0fe7fd424 100644 --- a/frontend/kesaseteli/employer/public/locales/fi/common.json +++ b/frontend/kesaseteli/employer/public/locales/fi/common.json @@ -68,7 +68,8 @@ "remove_employment": "Poista tiedot", "fetch_employment": "Hae tiedot", "fetch_employment_error_title": "Sattui virhe!", - "fetch_employment_error_message": "Ei hakenut työntekijän tietoja." + "fetch_employment_error_message": "Ei pystytty hakemaan työntekijän tietoja.", + "fetch_employment_not_found_error_message": "Työntekijän tietoja ei löytynyt." }, "step3": { "name": "Lähetä", diff --git a/frontend/kesaseteli/employer/public/locales/sv/common.json b/frontend/kesaseteli/employer/public/locales/sv/common.json index 132b944364..ba73fbb84c 100644 --- a/frontend/kesaseteli/employer/public/locales/sv/common.json +++ b/frontend/kesaseteli/employer/public/locales/sv/common.json @@ -68,7 +68,8 @@ "remove_employment": "Ta bort uppgifterna", "fetch_employment": "Hämta uppgifter", "fetch_employment_error_title": "Fel uppstod!", - "fetch_employment_error_message": "Kunde inte hämta arbetstagarens uppgifter." + "fetch_employment_error_message": "Kunde inte hämta arbetstagarens uppgifter.", + "fetch_employment_not_found_error_message": "Arbetstagarens information hittades inte." }, "step3": { "name": "Skicka", diff --git a/frontend/kesaseteli/employer/src/hooks/application/useApplicationApi.ts b/frontend/kesaseteli/employer/src/hooks/application/useApplicationApi.ts index d2e84f185a..458dff7871 100644 --- a/frontend/kesaseteli/employer/src/hooks/application/useApplicationApi.ts +++ b/frontend/kesaseteli/employer/src/hooks/application/useApplicationApi.ts @@ -142,7 +142,7 @@ const useApplicationApi = ( }, { onSuccess: (data) => { - const { employer_summer_voucher_id, ...updatedData } = data; + const {employer_summer_voucher_id, ...updatedData} = data; updateEmployment( draftApplication, employmentIndex, @@ -150,11 +150,21 @@ const useApplicationApi = ( onSuccess ); }, - onError: () => - showErrorToast( - t('common:application.step2.fetch_employment_error_title'), - t('common:application.step2.fetch_employment_error_message') - ), + onError: (error: unknown) => { + if (Axios.isAxiosError(error) && error.response.status === 404) { + // Not found error + showErrorToast( + t('common:application.step2.fetch_employment_error_title'), + t('common:application.step2.fetch_employment_not_found_error_message') + ) + } else { + // General error + showErrorToast( + t('common:application.step2.fetch_employment_error_title'), + t('common:application.step2.fetch_employment_error_message') + ) + } + } } ); };