Skip to content

Commit b13835d

Browse files
committed
move error message to constants
1 parent ee5e599 commit b13835d

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

packages/template-retail-react-app/app/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ export const FEATURE_UNAVAILABLE_ERROR_MESSAGE = defineMessage({
9999
defaultMessage: 'This feature is not currently available.',
100100
id: 'global.error.feature_unavailable'
101101
})
102+
export const CREATE_ACCOUNT_FIRST_ERROR_MESSAGE = defineMessage({
103+
defaultMessage: 'This feature is not currently available. You must create an account to access this feature.',
104+
id: 'global.error.create_account'
105+
})
102106

103107
export const HOME_HREF = '/'
104108

packages/template-retail-react-app/app/hooks/use-auth-modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import ResetPasswordForm from '@salesforce/retail-react-app/app/components/reset
3131
import RegisterForm from '@salesforce/retail-react-app/app/components/register'
3232
import PasswordlessEmailConfirmation from '@salesforce/retail-react-app/app/components/email-confirmation/index'
3333
import {noop} from '@salesforce/retail-react-app/app/utils/utils'
34-
import {API_ERROR_MESSAGE, FEATURE_UNAVAILABLE_ERROR_MESSAGE, LOGIN_TYPES, PASSWORDLESS_ERROR_MESSAGES} from '@salesforce/retail-react-app/app/constants'
34+
import {API_ERROR_MESSAGE, FEATURE_UNAVAILABLE_ERROR_MESSAGE, CREATE_ACCOUNT_FIRST_ERROR_MESSAGE, LOGIN_TYPES, PASSWORDLESS_ERROR_MESSAGES} from '@salesforce/retail-react-app/app/constants'
3535
import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation'
3636
import {usePrevious} from '@salesforce/retail-react-app/app/hooks/use-previous'
3737
import {usePasswordReset} from '@salesforce/retail-react-app/app/hooks/use-password-reset'
@@ -105,7 +105,7 @@ export const AuthModal = ({
105105
setCurrentView(EMAIL_VIEW)
106106
} catch (error) {
107107
const message = /error getting user info/i.test(error.message)
108-
? formatMessage(`${FEATURE_UNAVAILABLE_ERROR_MESSAGE} You must create an account to access this feature.`)
108+
? formatMessage(CREATE_ACCOUNT_FIRST_ERROR_MESSAGE)
109109
: PASSWORDLESS_ERROR_MESSAGES.some(msg => msg.test(error.message))
110110
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
111111
: formatMessage(API_ERROR_MESSAGE)

packages/template-retail-react-app/app/pages/login/index.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ import {
3131
FEATURE_UNAVAILABLE_ERROR_MESSAGE,
3232
LOGIN_TYPES,
3333
PASSWORDLESS_LOGIN_LANDING_PATH,
34-
PASSWORDLESS_ERROR_MESSAGES
34+
PASSWORDLESS_ERROR_MESSAGES,
35+
CREATE_ACCOUNT_FIRST_ERROR_MESSAGE
3536
} from '@salesforce/retail-react-app/app/constants'
3637
import {usePrevious} from '@salesforce/retail-react-app/app/hooks/use-previous'
3738
import {isServer} from '@salesforce/retail-react-app/app/utils/utils'
@@ -114,7 +115,7 @@ const Login = ({initialView = LOGIN_VIEW}) => {
114115
setCurrentView(EMAIL_VIEW)
115116
} catch (error) {
116117
const message = /error getting user info/i.test(error.message)
117-
? formatMessage(`${FEATURE_UNAVAILABLE_ERROR_MESSAGE} You must create an account to access this feature.`)
118+
? formatMessage(CREATE_ACCOUNT_FIRST_ERROR_MESSAGE)
118119
: PASSWORDLESS_ERROR_MESSAGES.some(msg => msg.test(error.message))
119120
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
120121
: formatMessage(API_ERROR_MESSAGE)

0 commit comments

Comments
 (0)