File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { useState } from "react" ;
1
2
import { useSelector } from "react-redux" ;
2
3
import { store } from "@/store" ;
3
4
import { useAddUserMutation } from "@/store/api" ;
@@ -21,6 +22,8 @@ const UserDialog = ({ refresh }) => {
21
22
22
23
const [ addUser , { isLoading } ] = useAddUserMutation ( ) ;
23
24
25
+ const [ role , setRole ] = useState ( ) ;
26
+
24
27
const handleSubmit = async ( e ) => {
25
28
e . preventDefault ( ) ;
26
29
await addUser ( {
@@ -30,7 +33,7 @@ const UserDialog = ({ refresh }) => {
30
33
} )
31
34
. unwrap ( )
32
35
. then ( ( ) => {
33
- toast ( { title : `Admin user added successfully` } ) ;
36
+ toast ( { title : `User added successfully` } ) ;
34
37
close ( ) ;
35
38
refresh ( ) ;
36
39
} ) ;
@@ -58,6 +61,8 @@ const UserDialog = ({ refresh }) => {
58
61
{ key : "Admin" , label : "ADMIN" } ,
59
62
{ key : "Spectator" , label : "SPECTATOR" }
60
63
] }
64
+ value = { role }
65
+ onChange = { ( e ) => setRole ( e . target . value ) }
61
66
/>
62
67
< AlertDialogFooter className = "mt-4" >
63
68
< Button type = "submit" loading = { isLoading } >
You can’t perform that action at this time.
0 commit comments