We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1fa2a71 commit ee9cf94Copy full SHA for ee9cf94
client/src/AdminDashboard/EnableUserSwitch.tsx
@@ -1,5 +1,6 @@
1
import React, { useState } from 'react';
2
import Switch from '@mui/material/Switch';
3
+import useAlert from '../util/hooks/useAlert';
4
5
interface EnableUserSwitchProps {
6
admin: boolean;
@@ -18,8 +19,14 @@ interface EnableUserSwitchProps {
18
19
*/
20
function EnableUserSwitch({ admin, email, enableUser }: EnableUserSwitchProps) {
21
const [checked, setChecked] = useState(true);
22
+ const { setAlert } = useAlert();
23
24
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
25
+ if (checked) {
26
+ setAlert('User Disabled', 'success');
27
+ } else {
28
+ setAlert('User Enabled', 'success');
29
+ }
30
setChecked(event.target.checked);
31
enableUser(email);
32
};
0 commit comments