UNPKG

elmer-ui-core

Version:

web app framework

44 lines (43 loc) 2.03 kB
import { AxiosResponse } from "axios"; import { IServiceConfig, IServiceEndPoint, IServiceRequest } from "../interface/IElmerService"; export declare type TypeI18nDefaultLocale = "zhGN" | "enGB"; export declare type TypeServiceEnv = "LOCAL" | "UAT" | "SIT" | "PROD"; export declare type TypeI18nConfig<I18nData, SupportLocales, Conversions> = { locale?: (keyof I18nData) | SupportLocales; converts?: Conversions; data: I18nData; }; export declare type TypeServiceError = { statusCode: string | number; message: string; resp: any; }; export declare type TypeRouterServiceEndPointOptions = { path: string; reduxActionType?: string; }; export declare type TypeRouterConfig<TypeRouterConfigData, RouterServiceConfigEndPointOptions> = { service: TypeServiceConfig<TypeRouterConfigData, RouterServiceConfigEndPointOptions & TypeRouterServiceEndPointOptions>; }; export declare type TypeServiceEvent = { status?: string | number; statusText?: string | number; canceled?: boolean; data?: any; }; export declare type TypeServiceConfig<TypeServiceConfigData, TypeServiceConfigEndPointOptions> = { common?: { onResponse?(resp: AxiosResponse, event?: TypeServiceEvent): boolean | undefined; onBefore?(endPoint: IServiceEndPoint<TypeServiceConfigEndPointOptions>, option?: IServiceRequest<any>): boolean | undefined; onError?(error: TypeServiceError): boolean | undefined; }; config: { [P in keyof TypeServiceConfigData]: IServiceConfig<any, TypeServiceConfigEndPointOptions>; }; }; export declare type TypeGlobalConfig<AppServiceNamespaceConfig, AppServiceConfigEndPointOptions, RouterServiceConfig, RouterServiceConfigEndPointOptions, I18nData, I18nLocales, I18nConvert, ENV> = { router?: TypeRouterConfig<RouterServiceConfig, RouterServiceConfigEndPointOptions>; service?: TypeServiceConfig<AppServiceNamespaceConfig, AppServiceConfigEndPointOptions>; i18n?: TypeI18nConfig<I18nData, I18nLocales, I18nConvert>; env?: any; };