aboutsummaryrefslogtreecommitdiff
path: root/modern/src/RemoveDialog.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-08 11:48:09 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-08 11:48:09 -0700
commit2352071211b61c10fa5bf5736baaff7809d18bf0 (patch)
tree743e4adc1cc35fb3585b912daaa8719ae5757f60 /modern/src/RemoveDialog.js
parent044733ff543156d76437daae8edb66850d785ac9 (diff)
downloadtrackermap-web-2352071211b61c10fa5bf5736baaff7809d18bf0.tar.gz
trackermap-web-2352071211b61c10fa5bf5736baaff7809d18bf0.tar.bz2
trackermap-web-2352071211b61c10fa5bf5736baaff7809d18bf0.zip
Organize common code
Diffstat (limited to 'modern/src/RemoveDialog.js')
-rw-r--r--modern/src/RemoveDialog.js37
1 files changed, 0 insertions, 37 deletions
diff --git a/modern/src/RemoveDialog.js b/modern/src/RemoveDialog.js
deleted file mode 100644
index 6d191d6a..00000000
--- a/modern/src/RemoveDialog.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react';
-import Button from '@material-ui/core/Button';
-import Dialog from '@material-ui/core/Dialog';
-import DialogActions from '@material-ui/core/DialogActions';
-import DialogContent from '@material-ui/core/DialogContent';
-import DialogContentText from '@material-ui/core/DialogContentText';
-import { useTranslation } from './LocalizationProvider';
-
-const RemoveDialog = ({
- open, endpoint, itemId, onResult,
-}) => {
- const t = useTranslation();
-
- const handleRemove = async () => {
- const response = await fetch(`/api/${endpoint}/${itemId}`, { method: 'DELETE' });
- if (response.ok) {
- onResult(true);
- }
- };
-
- return (
- <Dialog
- open={open}
- onClose={() => { onResult(false); }}
- >
- <DialogContent>
- <DialogContentText>{t('sharedRemoveConfirm')}</DialogContentText>
- </DialogContent>
- <DialogActions>
- <Button color="primary" onClick={handleRemove}>{t('sharedRemove')}</Button>
- <Button autoFocus onClick={() => onResult(false)}>{t('sharedCancel')}</Button>
- </DialogActions>
- </Dialog>
- );
-};
-
-export default RemoveDialog;