refactor: add typescript support to project

This commit is contained in:
HD
2022-06-29 16:54:58 +08:00
parent ccfee28e13
commit 003353e43f
33 changed files with 358 additions and 224 deletions
+8 -2
View File
@@ -27,9 +27,15 @@ interface Props {
closeModal: () => void;
}
interface BaseForm {
current: string;
newPassword: string;
confirmPassword: string;
}
const ProfileBasicEditModal: FC<Props> = ({ closeModal }) => {
const { data } = useGetCredentialsQuery();
const [input, setInput] = useState({
const [input, setInput] = useState<BaseForm>({
current: "",
newPassword: "",
confirmPassword: ""
@@ -37,7 +43,7 @@ const ProfileBasicEditModal: FC<Props> = ({ closeModal }) => {
// const dispatch = useDispatch();
const [updatePassword, { isLoading, isSuccess }] = useUpdatePasswordMutation();
const handleChange = (evt: ChangeEvent<HTMLInputElement>) => {
const { type } = evt.target.dataset;
const { type } = evt.target.dataset as { type: keyof BaseForm };
setInput((prev) => {
return { ...prev, [type]: evt.target.value };
});