chore: remove validators on the frontend (#1156)

* chore: update minlength of username

* remove the validator on frontend

* update
This commit is contained in:
Zeng1998
2023-02-25 14:59:29 +08:00
committed by GitHub
parent e64245099c
commit 57479b250a
7 changed files with 16 additions and 130 deletions

View File

@ -1,18 +1,10 @@
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useUserStore } from "../store/module";
import { validate, ValidatorConfig } from "../helpers/validator";
import Icon from "./Icon";
import { generateDialog } from "./Dialog";
import toastHelper from "./Toast";
const validateConfig: ValidatorConfig = {
minLength: 4,
maxLength: 320,
noSpace: true,
noChinese: true,
};
type Props = DialogProps;
const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
@ -51,12 +43,6 @@ const ChangePasswordDialog: React.FC<Props> = ({ destroy }: Props) => {
return;
}
const passwordValidResult = validate(newPassword, validateConfig);
if (!passwordValidResult.result) {
toastHelper.error(`${t("common.password")} ${t(passwordValidResult.reason as string)}`);
return;
}
try {
const user = userStore.getState().user as User;
await userStore.patchUser({