mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Fix issue where incorrect username validation message was displayed during signup
This commit is contained in:
parent
9ce5b0fa6f
commit
aec3238590
1 changed files with 5 additions and 5 deletions
|
|
@ -24,8 +24,12 @@ export function useValidateUsernameQuery({
|
|||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const isUsernameValid = (data as any)?.validateUsername ?? false
|
||||
const usernameErrorMessage = validationErrorMessage(username)
|
||||
if (isUsernameValid) {
|
||||
return { isUsernameValid }
|
||||
}
|
||||
|
||||
// Try to figure out why the username is invalid
|
||||
const usernameErrorMessage = validationErrorMessage(username.toLowerCase())
|
||||
if (usernameErrorMessage) {
|
||||
return {
|
||||
isUsernameValid: false,
|
||||
|
|
@ -33,10 +37,6 @@ export function useValidateUsernameQuery({
|
|||
}
|
||||
}
|
||||
|
||||
if (isUsernameValid) {
|
||||
return { isUsernameValid }
|
||||
}
|
||||
|
||||
return {
|
||||
isUsernameValid: false,
|
||||
usernameErrorMessage: 'This username is not available',
|
||||
|
|
|
|||
Loading…
Reference in a new issue