d91a13e2cc
🔄 Rename all "twake" instances to "tdrive"
36 lines
1.0 KiB
TypeScript
Executable File
36 lines
1.0 KiB
TypeScript
Executable File
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
import { Modal } from 'antd';
|
|
|
|
import Languages from 'app/features/global/services/languages-service';
|
|
import { TdriveService } from '../framework/registry-decorator-service';
|
|
|
|
const { confirm, info } = Modal;
|
|
|
|
type Options = {
|
|
title?: string;
|
|
text?: string;
|
|
};
|
|
@TdriveService('Alert')
|
|
class AlertServiceService {
|
|
alert(onClose: () => void, options?: Options) {
|
|
info({
|
|
title: options?.title || options?.text || '',
|
|
content: options?.text || '',
|
|
onCancel: onClose,
|
|
});
|
|
}
|
|
|
|
confirm(onConfirm: () => void, onClose: (() => void) | false = () => {}, options?: Options) {
|
|
confirm({
|
|
title: options?.title || Languages.t('components.alert.confirm'),
|
|
content: options?.text || Languages.t('components.alert.confirm_click'),
|
|
onOk: onConfirm,
|
|
onCancel: onClose || undefined,
|
|
cancelButtonProps: onClose ? {} : { style: { display: 'none' } },
|
|
});
|
|
}
|
|
}
|
|
const AlertManager = new AlertServiceService();
|
|
|
|
export default AlertManager;
|