fix(core): update
This commit is contained in:
		@@ -42,12 +42,11 @@ export class TypedHandler<T extends plugins.typedRequestInterfaces.ITypedRequest
 | 
			
		||||
        data: typedResponseError.errorData
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    if (response) {
 | 
			
		||||
      typedRequestArg.response = response;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    return typedRequestArg;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ import * as plugins from './typedrequest.plugins';
 | 
			
		||||
import { TypedResponseError } from './typedrequest.classes.typedresponseerror';
 | 
			
		||||
 | 
			
		||||
export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest> {
 | 
			
		||||
  public webrequest = new plugins.webrequest.WebRequest();
 | 
			
		||||
  public urlEndPoint: string;
 | 
			
		||||
  public method: string;
 | 
			
		||||
 | 
			
		||||
@@ -15,16 +16,18 @@ export class TypedRequest<T extends plugins.typedRequestInterfaces.ITypedRequest
 | 
			
		||||
   * firest the request
 | 
			
		||||
   */
 | 
			
		||||
  public async fire(fireArg: T['request']): Promise<T['response']> {
 | 
			
		||||
    const response = await plugins.smartrequest.postJson(this.urlEndPoint, {
 | 
			
		||||
      requestBody: {
 | 
			
		||||
        method: this.method,
 | 
			
		||||
        request: fireArg,
 | 
			
		||||
        response: null
 | 
			
		||||
      }
 | 
			
		||||
    const response = await this.webrequest.postJson(this.urlEndPoint, {
 | 
			
		||||
      method: this.method,
 | 
			
		||||
      request: fireArg,
 | 
			
		||||
      response: null
 | 
			
		||||
    });
 | 
			
		||||
    const responseBody: T = response.body;
 | 
			
		||||
    const responseBody: T = response;
 | 
			
		||||
    if (responseBody.error) {
 | 
			
		||||
      console.error(`Got an error ${responseBody.error.text} with data ${JSON.stringify(responseBody.error.data)}`);
 | 
			
		||||
      console.error(
 | 
			
		||||
        `Got an error ${responseBody.error.text} with data ${JSON.stringify(
 | 
			
		||||
          responseBody.error.data
 | 
			
		||||
        )}`
 | 
			
		||||
      );
 | 
			
		||||
      if (!responseBody.retry) {
 | 
			
		||||
        throw new TypedResponseError(responseBody.error.text, responseBody.error.data);
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,4 @@ export class TypedResponseError {
 | 
			
		||||
    this.errorText = errorTextArg;
 | 
			
		||||
    this.errorData = errorDataArg;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,6 @@ export { typedRequestInterfaces };
 | 
			
		||||
// pushrocks scope
 | 
			
		||||
import * as lik from '@pushrocks/lik';
 | 
			
		||||
import * as smartdelay from '@pushrocks/smartdelay';
 | 
			
		||||
import * as smartrequest from '@pushrocks/smartrequest';
 | 
			
		||||
import * as smartjson from '@pushrocks/smartjson';
 | 
			
		||||
import * as webrequest from '@pushrocks/webrequest';
 | 
			
		||||
 | 
			
		||||
export { lik, smartdelay, smartrequest, smartjson };
 | 
			
		||||
export { lik, smartdelay, webrequest };
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user