|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
import { Button, Dropdown, Input, Menu, MenuButton } from "@mui/joy";
|
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
|
import { toast } from "react-hot-toast";
|
|
|
|
|
import { userServiceClient } from "@/grpcweb";
|
|
|
|
|
import * as api from "@/helpers/api";
|
|
|
|
|
import { useUserStore } from "@/store/module";
|
|
|
|
|
import { UserNamePrefix } from "@/store/v1";
|
|
|
|
|
import { User_Role } from "@/types/proto/api/v2/user_service";
|
|
|
|
|
import { useTranslate } from "@/utils/i18n";
|
|
|
|
|
import showChangeMemberPasswordDialog from "../ChangeMemberPasswordDialog";
|
|
|
|
|
import { showCommonDialog } from "../Dialog/CommonDialog";
|
|
|
|
@ -53,16 +55,16 @@ const MemberSection = () => {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const userCreate: UserCreate = {
|
|
|
|
|
username: state.createUserUsername,
|
|
|
|
|
password: state.createUserPassword,
|
|
|
|
|
role: "USER",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
await api.createUser(userCreate);
|
|
|
|
|
await userServiceClient.createUser({
|
|
|
|
|
user: {
|
|
|
|
|
name: `${UserNamePrefix}${state.createUserUsername}`,
|
|
|
|
|
password: state.createUserPassword,
|
|
|
|
|
role: User_Role.USER,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} catch (error: any) {
|
|
|
|
|
toast.error(error.response.data.message);
|
|
|
|
|
toast.error(error.details);
|
|
|
|
|
}
|
|
|
|
|
await fetchUserList();
|
|
|
|
|
setState({
|
|
|
|
|