Skip to content

Commit 2ce4766

Browse files
committed
Fix: selected role in dropdown
1 parent 6220cfa commit 2ce4766

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/components/users/dialog.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useState } from "react";
12
import { useSelector } from "react-redux";
23
import { store } from "@/store";
34
import { useAddUserMutation } from "@/store/api";
@@ -21,6 +22,8 @@ const UserDialog = ({ refresh }) => {
2122

2223
const [addUser, { isLoading }] = useAddUserMutation();
2324

25+
const [role, setRole] = useState();
26+
2427
const handleSubmit = async (e) => {
2528
e.preventDefault();
2629
await addUser({
@@ -30,7 +33,7 @@ const UserDialog = ({ refresh }) => {
3033
})
3134
.unwrap()
3235
.then(() => {
33-
toast({ title: `Admin user added successfully` });
36+
toast({ title: `User added successfully` });
3437
close();
3538
refresh();
3639
});
@@ -58,6 +61,8 @@ const UserDialog = ({ refresh }) => {
5861
{ key: "Admin", label: "ADMIN" },
5962
{ key: "Spectator", label: "SPECTATOR" }
6063
]}
64+
value={role}
65+
onChange={(e) => setRole(e.target.value)}
6166
/>
6267
<AlertDialogFooter className="mt-4">
6368
<Button type="submit" loading={isLoading}>

0 commit comments

Comments
 (0)