feat: implement edit userinfo

This commit is contained in:
Steven
2023-06-23 20:52:00 +08:00
parent 9ad2eaebc5
commit 9b303da4eb
11 changed files with 173 additions and 189 deletions

View File

@ -1,18 +1,10 @@
import { Button, Input, Modal, ModalDialog } from "@mui/joy";
import { useState } from "react";
import { toast } from "react-hot-toast";
import { validate, ValidatorConfig } from "../helpers/validator";
import useLoading from "../hooks/useLoading";
import { userService } from "../services";
import Icon from "./Icon";
const validateConfig: ValidatorConfig = {
minLength: 3,
maxLength: 24,
noSpace: true,
noChinese: true,
};
interface Props {
onClose: () => void;
}
@ -49,12 +41,6 @@ const ChangePasswordDialog: React.FC<Props> = (props: Props) => {
return;
}
const passwordValidResult = validate(newPassword, validateConfig);
if (!passwordValidResult.result) {
toast.error("New password is invalid");
return;
}
requestState.setLoading();
try {
const user = userService.getState().user as User;