Skip to content

Commit db454ec

Browse files
committed
Disable create button if user got created
1 parent cd42be4 commit db454ec

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/pages/AccessManagement/Users.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const Users: FC = () => {
5151

5252
const { getRolesData } = useRole();
5353

54-
let rows =
54+
const rows =
5555
getUserIsSuccess && getUserData?.data ? (
5656
getUserData?.data.map((user: any) => {
5757
return (
@@ -88,7 +88,7 @@ const Users: FC = () => {
8888
};
8989

9090
const handleCreateUser = () => {
91-
let userRole: any = [];
91+
const userRole: any = [];
9292
if (SelectedRole !== '') {
9393
userRole.push(SelectedRole);
9494
}
@@ -99,7 +99,6 @@ const Users: FC = () => {
9999
if (getUserData?.data?.includes(createUserInput) || createUserInput.length < 3) {
100100
return true;
101101
}
102-
103102
if (SelectedRole !== '') {
104103
if (getRolesData?.data?.includes(SelectedRole)) {
105104
return false;
@@ -201,7 +200,7 @@ const Users: FC = () => {
201200
color="gray"
202201
className={classes.modalActionBtn}
203202
onClick={handleCreateUser}
204-
disabled={createVaildtion()}>
203+
disabled={createVaildtion() || !!createUserData?.data}>
205204
Create
206205
</Button>
207206
<Button onClick={handleClose} variant="outline" color="gray" className={classes.modalCancelBtn}>

0 commit comments

Comments
 (0)