I’m trying to validate that two passwords match and display an error if they do not. However, the error message is not showing up in my Vue component. Here is the relevant part of my code:
const issues = ref<FlatErrors<typeof UserSchema>['nested']>();
const UserSchema = pipe(
object({
email: pipe(
string(),
nonEmpty('Email is required'),
email('The email must be in the format [email protected]')
),
password: pipe(
string(),
nonEmpty('Password is required'),
minLength(6, 'Password must be at least 6 characters long')
),
confirmPassword: string(),
}),
forward(
partialCheck(
[['password'], ['confirmPassword']],
input => input.password === input.confirmPassword,
'Passwords do not match'
),
['confirmPassword']
)
);
// template
<template v-if="issues?.confirmPassword">
<span
class="register__errors"
v-for="(issue, i) in issues.confirmPassword"
:key="i"
>{{ issue }}</span
>
</template>