mirror of https://github.com/abpframework/abp.git
committed by
GitHub
8 changed files with 107 additions and 23 deletions
@ -0,0 +1,6 @@ |
|||
import { InjectionToken } from '@angular/core'; |
|||
import { HttpErrorResponse } from '@angular/common/http'; |
|||
|
|||
export const TENANT_NOT_FOUND_BY_NAME = new InjectionToken< |
|||
(HttpErrorResponse: HttpErrorResponse) => void |
|||
>('TENANT_NOT_FOUND_BY_NAME'); |
|||
@ -1,2 +1,3 @@ |
|||
export * from './ng-bootstrap-config.provider'; |
|||
export * from './route.provider'; |
|||
export * from './tenant-not-found.provider'; |
|||
|
|||
@ -0,0 +1,20 @@ |
|||
import { TENANT_NOT_FOUND_BY_NAME } from '@abp/ng.core'; |
|||
import { inject, Provider } from '@angular/core'; |
|||
import { ConfirmationService } from '../services'; |
|||
import { HttpErrorResponse } from '@angular/common/http'; |
|||
|
|||
export const tenantNotFoundProvider: Provider = { |
|||
provide: TENANT_NOT_FOUND_BY_NAME, |
|||
useFactory: function () { |
|||
const confirm = inject(ConfirmationService); |
|||
return (response: HttpErrorResponse) => { |
|||
const { error } = response.error; |
|||
// hide loading donut
|
|||
const appRoot = document.querySelector('app-root div.donut'); |
|||
if (appRoot) { |
|||
appRoot.remove(); |
|||
} |
|||
confirm.error(error.details, error.message, { hideCancelBtn: true, hideYesBtn: true }); |
|||
}; |
|||
}, |
|||
}; |
|||
Loading…
Reference in new issue