diff --git a/services/web/frontend/js/features/settings/components/account-info-section.tsx b/services/web/frontend/js/features/settings/components/account-info-section.tsx
index b158e8d5f8..11a027cc0f 100644
--- a/services/web/frontend/js/features/settings/components/account-info-section.tsx
+++ b/services/web/frontend/js/features/settings/components/account-info-section.tsx
@@ -7,7 +7,10 @@ import {
FormGroup,
} from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
-import { postJSON } from '../../../infrastructure/fetch-json'
+import {
+ getUserFacingMessage,
+ postJSON,
+} from '../../../infrastructure/fetch-json'
import getMeta from '../../../utils/meta'
import { ExposedSettings } from '../../../../../types/exposed-settings'
import useAsync from '../../../shared/hooks/use-async'
@@ -109,7 +112,7 @@ function AccountInfoSection() {
) : null}
{isError ? (
- {error.getUserFacingMessage()}
+ {getUserFacingMessage(error)}
) : null}
{canUpdateEmail || canUpdateNames ? (
diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/institution-fields.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/institution-fields.tsx
index 1fa409e341..a4de478da1 100644
--- a/services/web/frontend/js/features/settings/components/emails/add-email/institution-fields.tsx
+++ b/services/web/frontend/js/features/settings/components/emails/add-email/institution-fields.tsx
@@ -49,7 +49,7 @@ function InstitutionFields({
const [isInstitutionFieldsVisible, setIsInstitutionFieldsVisible] =
useState(false)
const [isUniversityDirty, setIsUniversityDirty] = useState(false)
- const { runAsync: institutionRunAsync } = useAsync()
+ const { runAsync: institutionRunAsync } = useAsync()
useEffect(() => {
if (isInstitutionFieldsVisible && countryRef.current) {
@@ -93,7 +93,7 @@ function InstitutionFields({
return
}
- institutionRunAsync(
+ institutionRunAsync(
getJSON(`/institutions/list?country_code=${countryCode}`)
)
.then(data => {
diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx
index dfde8e7cb9..2ca36f0d19 100644
--- a/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx
+++ b/services/web/frontend/js/features/settings/components/emails/add-email/layout.tsx
@@ -1,6 +1,7 @@
import { Row, Alert } from 'react-bootstrap'
import Icon from '../../../../../shared/components/icon'
import { UseAsyncReturnType } from '../../../../../shared/hooks/use-async'
+import { getUserFacingMessage } from '../../../../../infrastructure/fetch-json'
type LayoutProps = {
children: React.ReactNode
@@ -14,7 +15,7 @@ function Layout({ isError, error, children }: LayoutProps) {
{children}
{isError && (
- {error.getUserFacingMessage()}
+ {getUserFacingMessage(error)}
)}
diff --git a/services/web/frontend/js/features/settings/components/emails/institution-and-role.tsx b/services/web/frontend/js/features/settings/components/emails/institution-and-role.tsx
index e7ecdcee76..d93e726598 100644
--- a/services/web/frontend/js/features/settings/components/emails/institution-and-role.tsx
+++ b/services/web/frontend/js/features/settings/components/emails/institution-and-role.tsx
@@ -18,7 +18,7 @@ type InstitutionAndRoleProps = {
function InstitutionAndRole({ userEmailData }: InstitutionAndRoleProps) {
const { t } = useTranslation()
const { isLoading, isError, runAsync } = useAsync()
- const changeAffiliationAsync = useAsync()
+ const changeAffiliationAsync = useAsync()
const { affiliation } = userEmailData
const {
state,
@@ -55,9 +55,7 @@ function InstitutionAndRole({ userEmailData }: InstitutionAndRoleProps) {
}
changeAffiliationAsync
- .runAsync(
- getJSON(`/institutions/list/${affiliation.institution.id}`)
- )
+ .runAsync(getJSON(`/institutions/list/${affiliation.institution.id}`))
.then(data => {
if (data.departments.length) {
setDepartments(data.departments)
diff --git a/services/web/frontend/js/features/settings/components/password-section.tsx b/services/web/frontend/js/features/settings/components/password-section.tsx
index 31dbe432a4..367a90732a 100644
--- a/services/web/frontend/js/features/settings/components/password-section.tsx
+++ b/services/web/frontend/js/features/settings/components/password-section.tsx
@@ -7,12 +7,21 @@ import {
FormGroup,
} from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
-import { postJSON } from '../../../infrastructure/fetch-json'
+import {
+ getUserFacingMessage,
+ postJSON,
+} from '../../../infrastructure/fetch-json'
import getMeta from '../../../utils/meta'
import { ExposedSettings } from '../../../../../types/exposed-settings'
import { PasswordStrengthOptions } from '../../../../../types/password-strength-options'
import useAsync from '../../../shared/hooks/use-async'
+type PasswordUpdateResult = {
+ message?: {
+ text: string
+ }
+}
+
function PasswordSection() {
const { t } = useTranslation()
@@ -58,7 +67,8 @@ function PasswordForm() {
const [currentPassword, setCurrentPassword] = useState('')
const [newPassword1, setNewPassword1] = useState('')
const [newPassword2, setNewPassword2] = useState('')
- const { isLoading, isSuccess, isError, data, error, runAsync } = useAsync()
+ const { isLoading, isSuccess, isError, data, error, runAsync } =
+ useAsync()
const [isNewPasswordValid, setIsNewPasswordValid] = useState(false)
const [isFormValid, setIsFormValid] = useState(false)
@@ -128,7 +138,7 @@ function PasswordForm() {
) : null}
{isError ? (
- {error.getUserFacingMessage()}
+ {getUserFacingMessage(error)}
) : null}