本文整理匯總了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)
}
}