AlainConfig
核心配置对象。
一个配置对象 AlainConfig, 它有一个默认的
一个配置服务:AlainConfigService
https://github.com/ng-alain/delon/blob/master/packages/util/config/config.types.ts
export interface AlainConfig {
dataRange?: AlainDateRangePickerConfig;
exception?: AlainExceptionType;
errorCollect?: AlainErrorCollectConfig;
image?: AlainImageConfig;
loading?: AlainLoadingConfig;
onboarding?: AlainOnboardingConfig;
lodop?: AlainLodopConfig;
pageHeader?: AlainPageHeaderConfig;
qr?: AlainQRConfig;
se?: AlainSEConfig;
sg?: AlainSGConfig;
sv?: AlainSVConfig;
st?: AlainSTConfig;
sf?: AlainSFConfig;
xlsx?: AlainXlsxConfig;
zip?: AlainZipConfig;
pdf?: AlainPdfConfig;
media?: AlainMediaConfig;
acl?: AlainACLConfig;
auth?: AlainAuthConfig;
cache?: AlainCacheConfig;
chart?: AlainChartConfig;
mock?: AlainMockConfig;
utilArray?: AlainUtilArrayConfig;
utilCurrency?: AlainUtilCurrencyConfig;
themeHttp?: AlainThemeHttpClientConfig;
themeResponsive?: AlainThemeResponsiveConfig;
themeI18n?: AlainThemeI18nConfig;
}
export const ALAIN_CONFIG = new InjectionToken<AlainConfig>('alain-config', {
providedIn: 'root',
factory: ALAIN_CONFIG_FACTORY
});
export function ALAIN_CONFIG_FACTORY(): AlainConfig {
return {};
}
定义了返回配置的 Token: ALAIN_CONFIG
还有一个返回配置信息的工厂 ALAIN_CONFIG_FACTORY
其中 AlainAuthConfig 的默认值见:https://github.com/ng-alain/delon/blob/master/packages/auth/src/auth.config.ts
import type { AlainAuthConfig, AlainConfigService } from '@delon/util/config';
export const AUTH_DEFAULT_CONFIG: AlainAuthConfig = {
store_key: `_token`,
token_invalid_redirect: true,
token_exp_offset: 10,
token_send_key: `token`,
token_send_template: '${token}',
token_send_place: 'header',
login_url: '/login',
ignores: [/\/login/, /assets\//, /passport\//],
allow_anonymous_key: `_allow_anonymous`,
executeOtherInterceptors: true,
refreshTime: 3000,
refreshOffset: 6000
};
export function mergeConfig(srv: AlainConfigService): AlainAuthConfig {
return srv.merge('auth', AUTH_DEFAULT_CONFIG)!;
}
冠军
标签:AlainConfig,CONFIG,ALAIN,AlainAuthConfig,token,config From: https://blog.51cto.com/u_8130830/6144371