本文整理汇总了TypeScript中@colmena/admin-ui.UiService.alertError方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UiService.alertError方法的具体用法?TypeScript UiService.alertError怎么用?TypeScript UiService.alertError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@colmena/admin-ui.UiService
的用法示例。
在下文中一共展示了UiService.alertError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: handleAction
handleAction(event) {
switch (event.type) {
case 'generateToken':
return this.service.generateToken(
this.item,
() => {
this.refreshTokens()
this.uiService.toastSuccess('Generate Token Success', `A new token has been generated for <u>${this.item.username}</u>`)
},
err => this.uiService.toastError('Generate Token Fail', err.message)
)
case 'deleteToken':
return this.service.deleteToken(
{
user: this.item,
token: event.payload,
},
() => {
this.refreshTokens()
this.uiService.toastSuccess('Delete Token Success', `Token <u>${event.payload.id}</u> has been deleted successfully`)
},
err => this.uiService.toastError('Delete Token Fail', err.message)
)
case 'removeTtl':
return this.service.removeTtl(
{
user: this.item,
token: event.payload,
},
() => {
this.refreshTokens()
this.uiService.toastSuccess('Remove TTL Success', `TTL for token <u>${event.payload.id} has been removed successfully`)
},
err => this.uiService.toastError('Remove TTL Fail', err.message)
)
case 'deleteAllTokens':
const successCb = () => this.service.deleteAllTokens(
this.item,
() => {
this.refreshTokens()
this.uiService.toastSuccess('Delete All Tokens Success', `All tokens for <u>${this.item.username}</u> have been deleted successfully`)
},
err => this.uiService.toastError('Delete All Tokens Fail', err.message)
)
const question = { title: 'Are you sure?', text: 'This action cannot be undone' }
return this.uiService.alertError(question, successCb, () => ({}))
default:
return console.log('Unknown Event Type', event)
}
}