-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertUtils.ts
More file actions
113 lines (96 loc) · 2.76 KB
/
AlertUtils.ts
File metadata and controls
113 lines (96 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import { message as _message, notification as _notification, Modal as _Modal } from 'antd';
export class Message {
public info = (content: string, duration: number = 2) => {
_message.info(content, duration);
}
public success = (content: string, duration: number = 2) => {
_message.success(content, duration);
}
public error = (content: string, duration: number = 2) => {
_message.error(content, duration);
}
public warning = (content: string, duration: number = 2) => {
_message.warning(content, duration);
}
public loading = (content: string, duration: number = 2) => {
_message.loading(content, duration);
}
}
export class Notification {
public open = (msg: string, description: string) => {
_notification.open({
message: msg,
description: description,
});
}
public success = (msg: string, description: string) => {
_notification.success({
message: msg,
description: description,
});
}
public info = (msg: string, description: string) => {
_notification.info({
message: msg,
description: description,
});
}
public warning = (msg: string, description: string) => {
_notification.warning({
message: msg,
description: description,
});
}
public error = (msg: string, description: string) => {
_notification.error({
message: msg,
description: description,
});
}
}
export class AntModal {
public open = (content: string) => {
_Modal.info({
icon: null,
content: content,
centered: true,
});
}
public info = (title: string, content: string) => {
_Modal.info({
title: title,
content: content,
});
}
public success = (content: string) => {
_Modal.success({
content: content,
});
}
public error = (title: string, content: string) => {
_Modal.error({
title: title,
content: content,
});
}
public warning = (title: string, content: string) => {
_Modal.warning({
title: title,
content: content,
});
}
public confirm = (title: string, content: string, value: any, callback: (value: any, action?: any) => void, okText:string = 'OK') => {
_Modal.confirm({
title: title,
content: content,
okText: okText,
centered: true,
onOk: () => {
callback(value, 'ok');
},
onCancel: () => {
callback(value, 'cancel');
},
});
}
}