fix: 代码结构调整

This commit is contained in:
guokai.jgk 2020-10-13 17:29:40 +08:00
parent 64a477cf35
commit af4bc83cc3
4 changed files with 8 additions and 8 deletions

View File

@ -16,7 +16,7 @@ export function createMopenHandler<T = unknown>(
appKey: MOPEN_APPKEY_XSPACE_PRE_ONLINE,
},
) {
return async function (options: RuntimeOptionsConfig): Promise<{ data: T }> {
return async function(options: RuntimeOptionsConfig): Promise<{ data: T }> {
const { data, response } = await MopenClient.request<T>({
config,
...options,

View File

@ -9,9 +9,11 @@ export type DataType = 'jsonp' | 'json' | 'originaljsonp';
// 考虑一下 mtop 类型的问题,官方没有提供 ts 文件
export function createMtopHandler<T = unknown>(config?: MTopConfig) {
if (config && Object.keys(config).length > 0) {
Object.keys(config).forEach((key: string) => mtopRequest.config(key, config[key]));
Object.keys(config).forEach((key: string) =>
mtopRequest.config(key, config[key]),
);
}
return async function (options: RuntimeOptionsConfig): Promise<{ data: T }> {
return async function(options: RuntimeOptionsConfig): Promise<{ data: T }> {
const response = await mtopRequest.request<T>({
api: options.uri,
v: (options.v as string) || '1.0',

View File

@ -16,7 +16,7 @@
"prepublishOnly": "npm run build"
},
"dependencies": {
"@ali/lowcode-types": "^1.0.10",
"@ali/lowcode-types": "^0.8.13",
"query-string": "^6.13.1",
"typescript": "^3.9.7"
},

View File

@ -1,10 +1,8 @@
import qs from 'query-string';
import { UrlParamsHandler } from '@ali/lowcode-types';
export function createUrlParamsHandler<T = unknown>(
searchString: string | T = '',
): UrlParamsHandler<T> {
return async function (): Promise<T> {
export function createUrlParamsHandler<T = unknown>(searchString: string | T = ''): UrlParamsHandler<T> {
return async function(): Promise<T> {
if (typeof searchString === 'string') {
const params = (qs.parse(searchString) as unknown) as T;
return params;