aboutsummaryrefslogtreecommitdiff
path: root/modern/src/RemoveDialog.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/RemoveDialog.js')
-rw-r--r--modern/src/RemoveDialog.js32
1 files changed, 21 insertions, 11 deletions
diff --git a/modern/src/RemoveDialog.js b/modern/src/RemoveDialog.js
index 14952e64..bca936f4 100644
--- a/modern/src/RemoveDialog.js
+++ b/modern/src/RemoveDialog.js
@@ -7,18 +7,28 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
const RemoveDialog = (props) => {
+ const handleRemove = () => {
+ fetch(`/api/devices/${props.deviceId}`, { method: 'DELETE' }).then(response => {
+ if (response.ok) {
+ props.onResult(true);
+ }
+ });
+ }
+
return (
- <Dialog
- open={props.open}
- onClose={() => { props.onClose() }}>
- <DialogContent>
- <DialogContentText>{t('sharedRemoveConfirm')}</DialogContentText>
- </DialogContent>
- <DialogActions>
- <Button color="primary">{t('sharedRemove')}</Button>
- <Button color="primary" autoFocus>{t('sharedCancel')}</Button>
- </DialogActions>
- </Dialog>
+ <>
+ <Dialog
+ open={props.open}
+ onClose={() => { props.onResult(false) }}>
+ <DialogContent>
+ <DialogContentText>{t('sharedRemoveConfirm')}</DialogContentText>
+ </DialogContent>
+ <DialogActions>
+ <Button color="primary" onClick={handleRemove}>{t('sharedRemove')}</Button>
+ <Button autoFocus onClick={() => props.onResult(false)}>{t('sharedCancel')}</Button>
+ </DialogActions>
+ </Dialog>
+ </>
);
};