Skip to content

Commit ee9cf94

Browse files
committed
1 parent 1fa2a71 commit ee9cf94

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

client/src/AdminDashboard/EnableUserSwitch.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react';
22
import Switch from '@mui/material/Switch';
3+
import useAlert from '../util/hooks/useAlert';
34

45
interface EnableUserSwitchProps {
56
admin: boolean;
@@ -18,8 +19,14 @@ interface EnableUserSwitchProps {
1819
*/
1920
function EnableUserSwitch({ admin, email, enableUser }: EnableUserSwitchProps) {
2021
const [checked, setChecked] = useState(true);
22+
const { setAlert } = useAlert();
2123

2224
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
25+
if (checked) {
26+
setAlert('User Disabled', 'success');
27+
} else {
28+
setAlert('User Enabled', 'success');
29+
}
2330
setChecked(event.target.checked);
2431
enableUser(email);
2532
};

0 commit comments

Comments
 (0)