import React from 'react'; import { useHistory } from 'react-router'; import { Trans } from 'react-i18next'; import OperationDialog from '../common/OperationDialog'; import { timelineService } from '../data/timeline'; interface TimelineDeleteDialog { open: boolean; name: string; close: () => void; } const TimelineDeleteDialog: React.FC = (props) => { const history = useHistory(); const { name } = props; return ( { return ( 0{{ name }}2 ); }} inputScheme={[ { type: 'text', validator: (value) => { if (value !== name) { return 'timeline.deleteDialog.notMatch'; } else { return null; } }, }, ]} onProcess={() => { return timelineService.deleteTimeline(name).toPromise(); }} onSuccessAndClose={() => { history.replace('/'); }} /> ); }; export default TimelineDeleteDialog;