mirror of https://github.com/abpframework/abp.git
5 changed files with 48 additions and 5 deletions
@ -0,0 +1,18 @@ |
|||||
|
import { Type } from '@angular/core'; |
||||
|
|
||||
|
export interface RootParams { |
||||
|
httpErrorConfig: HttpErrorConfig; |
||||
|
} |
||||
|
|
||||
|
export type ErrorScreenErrorCodes = 401 | 403 | 404 | 500; |
||||
|
|
||||
|
export interface HttpErrorConfig { |
||||
|
errorScreen?: { |
||||
|
component: Type<any>; |
||||
|
forWhichErrors?: |
||||
|
| [ErrorScreenErrorCodes] |
||||
|
| [ErrorScreenErrorCodes, ErrorScreenErrorCodes] |
||||
|
| [ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes] |
||||
|
| [ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes, ErrorScreenErrorCodes]; |
||||
|
}; |
||||
|
} |
||||
@ -1,18 +1,19 @@ |
|||||
import { Toaster } from './toaster'; |
import { Toaster } from './toaster'; |
||||
|
import { Config } from '@abp/ng.core'; |
||||
|
|
||||
export namespace Confirmation { |
export namespace Confirmation { |
||||
export interface Options extends Toaster.Options { |
export interface Options extends Toaster.Options { |
||||
hideCancelBtn?: boolean; |
hideCancelBtn?: boolean; |
||||
hideYesBtn?: boolean; |
hideYesBtn?: boolean; |
||||
cancelText?: string; |
cancelText?: Config.LocalizationParam; |
||||
yesText?: string; |
yesText?: Config.LocalizationParam; |
||||
/** |
/** |
||||
* @deprecated to be deleted in v2 |
* @deprecated to be deleted in v2 |
||||
*/ |
*/ |
||||
cancelCopy?: string; |
cancelCopy?: Config.LocalizationParam; |
||||
/** |
/** |
||||
* @deprecated to be deleted in v2 |
* @deprecated to be deleted in v2 |
||||
*/ |
*/ |
||||
yesCopy?: string; |
yesCopy?: Config.LocalizationParam; |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,15 @@ |
|||||
|
import { InjectionToken } from '@angular/core'; |
||||
|
import { HttpErrorConfig } from '../models/common'; |
||||
|
|
||||
|
export function httpErrorConfigFactory(config = {} as HttpErrorConfig) { |
||||
|
if (config.errorScreen && config.errorScreen.component && !config.errorScreen.forWhichErrors) { |
||||
|
config.errorScreen.forWhichErrors = [401, 403, 404, 500]; |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
errorScreen: {}, |
||||
|
...config, |
||||
|
} as HttpErrorConfig; |
||||
|
} |
||||
|
|
||||
|
export const HTTP_ERROR_CONFIG = new InjectionToken('HTTP_ERROR_CONFIG'); |
||||
Loading…
Reference in new issue