fix(next): adds token to reset password initialState (#13067)

### What?
Adds `token` into the `initialState` for the reset password form to
ensure `token` does not get passed through as `undefined`.

### Why?
Currently the reset password UI is broken because `token` is not getting
passed to the form state.

### How?
Adds `token` to `initialState`

Fixes #13040
This commit is contained in:
Jessica Rynkar
2025-07-07 20:09:11 +01:00
committed by GitHub
parent 6d5cc843a2
commit f4f13a26c7

View File

@@ -18,19 +18,6 @@ type Args = {
readonly token: string
}
const initialState: FormState = {
'confirm-password': {
initialValue: '',
valid: false,
value: '',
},
password: {
initialValue: '',
valid: false,
value: '',
},
}
export const ResetPasswordForm: React.FC<Args> = ({ token }) => {
const i18n = useTranslation()
const {
@@ -61,6 +48,24 @@ export const ResetPasswordForm: React.FC<Args> = ({ token }) => {
}
}, [adminRoute, fetchFullUser, history, loginRoute])
const initialState: FormState = {
'confirm-password': {
initialValue: '',
valid: false,
value: '',
},
password: {
initialValue: '',
valid: false,
value: '',
},
token: {
initialValue: token,
valid: true,
value: token,
},
}
return (
<Form
action={`${serverURL}${apiRoute}/${userSlug}/reset-password`}