Commit 12efd840 by Sixong.Zhu

u

parent 2d3f735b
Showing with 34 additions and 0 deletions
import { UniplatSdk } from "uniplat-sdk";
export const enum BenefitServiceName {
CompanyApi = 'company_api'
}
export const enum BenefitApiName {
Home = 'home_data'
}
export class BenefitInvoker {
private static readonly subProject = 'welfare_v2';
private static readonly unsetupError = '服务尚未初始化';
private static sdk: UniplatSdk | null = null;
public static setup(sdk: UniplatSdk) {
this.sdk = sdk;
return this;
}
public static get<T>(service: BenefitServiceName, api: BenefitApiName) {
if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('get');
}
return Promise.reject(this.unsetupError);
}
public static post<T>(service: BenefitServiceName, api: BenefitApiName, data?: any) {
if (this.sdk) {
return this.sdk.domainService(this.subProject, service, api).request<{}, {}, T>('post', { data });
}
return Promise.reject(this.unsetupError);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment