From d3a027a92958371acaf35d300770a4c864df7231 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 21 Jun 2020 17:42:00 -0700 Subject: Implement device removal --- modern/src/RemoveDialog.js | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'modern/src/RemoveDialog.js') diff --git a/modern/src/RemoveDialog.js b/modern/src/RemoveDialog.js index 14952e6..bca936f 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 ( - { props.onClose() }}> - - {t('sharedRemoveConfirm')} - - - - - - + <> + { props.onResult(false) }}> + + {t('sharedRemoveConfirm')} + + + + + + + ); }; -- cgit v1.2.3