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, '>')
|
.replace(/>/g, '>')
|
||||||
|
|
||||||
export const alerts = {
|
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) => {
|
log: (message: string, type: LogType, callback?: Closure) => {
|
||||||
alertify.confirm(msg, okFunc, cancelFunc)
|
|
||||||
},
|
|
||||||
|
|
||||||
log: (msg: string, type: LogType = 'log', cb?: Closure) => {
|
|
||||||
alertify.logPosition('top right')
|
alertify.logPosition('top right')
|
||||||
alertify.closeLogOnClick(true)
|
alertify.closeLogOnClick(true)
|
||||||
alertify[type](encodeEntities(msg), cb)
|
alertify[type](encodeEntities(message), callback)
|
||||||
},
|
},
|
||||||
|
|
||||||
success (msg: string, cb?: Closure) {
|
success (message: string, callback?: Closure) {
|
||||||
this.log(msg, 'success', cb)
|
this.log(message, 'success', callback)
|
||||||
},
|
},
|
||||||
|
|
||||||
error (msg: string, cb?: Closure) {
|
error (message: string, callback?: Closure) {
|
||||||
this.log(msg, 'error', cb)
|
this.log(message, 'error', callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue