當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript UiService.alertError方法代碼示例

本文整理匯總了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)
   }
 }
開發者ID:beeman,項目名稱:loopback-angular-admin,代碼行數:50,代碼來源:user-access-tokens.component.ts


注:本文中的@colmena/admin-ui.UiService.alertError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。