|
|
@ -31,9 +31,19 @@ const UserEdit = () => {
|
|
|
|
const { id } = useParams<params>();
|
|
|
|
const { id } = useParams<params>();
|
|
|
|
|
|
|
|
|
|
|
|
const { data, refetch, status } = useUserOne(id);
|
|
|
|
const { data, refetch, status } = useUserOne(id);
|
|
|
|
|
|
|
|
const roleData = useRoleData();
|
|
|
|
|
|
|
|
const techSupport = roleData.data?.find(
|
|
|
|
|
|
|
|
(item) => item.name === "Tech Support"
|
|
|
|
|
|
|
|
);
|
|
|
|
const onSubmit = async (value: any) => {
|
|
|
|
const onSubmit = async (value: any) => {
|
|
|
|
|
|
|
|
if (value.role_id === techSupport?.id) {
|
|
|
|
|
|
|
|
value.team_id = null;
|
|
|
|
|
|
|
|
|
|
|
|
id && (await userController.userPatch(value, id));
|
|
|
|
id && (await userController.userPatch(value, id));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
id && (await userController.userPatch(value, id));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
refetch();
|
|
|
|
refetch();
|
|
|
|
document.location.replace("/#/users/");
|
|
|
|
document.location.replace("/#/users/");
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -47,7 +57,6 @@ const UserEdit = () => {
|
|
|
|
if (TeamOption) {
|
|
|
|
if (TeamOption) {
|
|
|
|
TeamOption.unshift(noTeamOption);
|
|
|
|
TeamOption.unshift(noTeamOption);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const roleData = useRoleData();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ClickDelete = () => {
|
|
|
|
const ClickDelete = () => {
|
|
|
|
const shouldDelete = window.confirm(
|
|
|
|
const shouldDelete = window.confirm(
|
|
|
|