Skip to content

Commit 2531c5c

Browse files
committed
handle invalid token error for reset password
1 parent 4917ef3 commit 2531c5c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const Login = ({initialView = LOGIN_VIEW}) => {
153153

154154
const passwordlessLogin = async() => {
155155
try {
156-
const res = await loginPasswordless.mutateAsync({pwdlessLoginToken: token})
156+
await loginPasswordless.mutateAsync({pwdlessLoginToken: token})
157157
} catch (e) {
158158
const errorData = await e.response?.json()
159159
const message = /invalid token/i.test(errorData.message)

packages/template-retail-react-app/app/pages/reset-password/reset-password-landing.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ const ResetPasswordLanding = () => {
4646
await resetPassword({email, token, newPassword: values.password})
4747
navigate('/login')
4848
} catch (error) {
49-
const message = /Unauthorized/i.test(error.message)
49+
const errorData = await error.response?.json()
50+
const message = /invalid token/i.test(errorData.message)
5051
? formatMessage(INVALID_TOKEN_ERROR_MESSAGE)
5152
: formatMessage(API_ERROR_MESSAGE)
5253
form.setError('global', {type: 'manual', message})

0 commit comments

Comments
 (0)