1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import { axiosUtils } from "./axiosUtils";
- import { toolUtils } from "../toolUtils";
- export class httpUtils extends axiosUtils {
- protected constructor(baseUrl: string) {
- super();
- this.baseUrl = baseUrl;
- }
-
- private _baseUrl = "";
- private set baseUrl(val: string) {
- this._baseUrl = val;
- }
- private get baseUrl() {
- return this._baseUrl;
- }
- private async send(url: string, data: any, superFnName: string) {
- var newUrl = toolUtils.getBaseHttpUrl(this.baseUrl, url);
- return await super[superFnName](newUrl, data);
- }
-
- public async getRequest(url: string, data: any) {
- return await this.send(url, data, "getRequest");
- }
-
- public async postRequest(url: string, data: any) {
- return await this.send(url, data, "postRequest");
- }
-
- protected async customRequest(
- url: string,
- headers: any,
- data: any,
- method: string
- ) {
- return await super.customRequest(url, headers, data, method);
- }
- }
|