mirror of
https://github.com/koel/koel
synced 2024-11-28 06:50:27 +00:00
chore: clean up alerts
This commit is contained in:
parent
6f0d6e8abc
commit
2acd1c2317
1 changed files with 8 additions and 11 deletions
|
@ -7,23 +7,20 @@ const encodeEntities = (str: string) => str.replace(/&/g, '&')
|
|||
.replace(/>/g, '>')
|
||||
|
||||
export const alerts = {
|
||||
alert: (msg: string) => alertify.alert(encodeEntities(msg)),
|
||||
alert: (message: string) => alertify.alert(encodeEntities(message)),
|
||||
confirm: (message: string, onOk: Closure, onCancel?: Closure) => alertify.confirm(message, onOk, onCancel),
|
||||
|
||||
confirm: (msg: string, okFunc: Closure, cancelFunc?: Closure) => {
|
||||
alertify.confirm(msg, okFunc, cancelFunc)
|
||||
},
|
||||
|
||||
log: (msg: string, type: LogType = 'log', cb?: Closure) => {
|
||||
log: (message: string, type: LogType, callback?: Closure) => {
|
||||
alertify.logPosition('top right')
|
||||
alertify.closeLogOnClick(true)
|
||||
alertify[type](encodeEntities(msg), cb)
|
||||
alertify[type](encodeEntities(message), callback)
|
||||
},
|
||||
|
||||
success (msg: string, cb?: Closure) {
|
||||
this.log(msg, 'success', cb)
|
||||
success (message: string, callback?: Closure) {
|
||||
this.log(message, 'success', callback)
|
||||
},
|
||||
|
||||
error (msg: string, cb?: Closure) {
|
||||
this.log(msg, 'error', cb)
|
||||
error (message: string, callback?: Closure) {
|
||||
this.log(message, 'error', callback)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue