Commit d63a5eee authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Adding type to CreateProductOrder method

parent ab7068c8
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -9,12 +9,13 @@ import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { RequestBuilder } from '../../request-builder';


import { ProductOrderCreate } from '../../models/product-order-create';
import { ProductOrderCreate } from '../../models/product-order-create';
import { ProductOrder } from '../../models';


export interface CreateProductOrder$Params {
export interface CreateProductOrder$Params {
      body: ProductOrderCreate
      body: ProductOrderCreate
}
}


export function createProductOrder(http: HttpClient, rootUrl: string, params: CreateProductOrder$Params, context?: HttpContext): Observable<StrictHttpResponse<void>> {
export function createProductOrder(http: HttpClient, rootUrl: string, params: CreateProductOrder$Params, context?: HttpContext): Observable<StrictHttpResponse<ProductOrder>> {
  const rb = new RequestBuilder(rootUrl, createProductOrder.PATH, 'post');
  const rb = new RequestBuilder(rootUrl, createProductOrder.PATH, 'post');
  if (params) {
  if (params) {
    rb.body(params.body, 'application/json;charset=utf-8');
    rb.body(params.body, 'application/json;charset=utf-8');
@@ -25,7 +26,7 @@ export function createProductOrder(http: HttpClient, rootUrl: string, params: Cr
  ).pipe(
  ).pipe(
    filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
    filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
    map((r: HttpResponse<any>) => {
    map((r: HttpResponse<any>) => {
      return (r as HttpResponse<any>).clone({ body: undefined }) as StrictHttpResponse<void>;
      return (r as HttpResponse<any>).clone({ body: undefined }) as StrictHttpResponse<ProductOrder>;
    })
    })
  );
  );
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -83,7 +83,7 @@ export class ProductOrderService extends BaseService {
   *
   *
   * This method sends `application/json;charset=utf-8` and handles request body of type `application/json;charset=utf-8`.
   * This method sends `application/json;charset=utf-8` and handles request body of type `application/json;charset=utf-8`.
   */
   */
  createProductOrder$Response(params: CreateProductOrder$Params, context?: HttpContext): Observable<StrictHttpResponse<void>> {
  createProductOrder$Response(params: CreateProductOrder$Params, context?: HttpContext): Observable<StrictHttpResponse<ProductOrder>> {
    return createProductOrder(this.http, this.rootUrl, params, context);
    return createProductOrder(this.http, this.rootUrl, params, context);
  }
  }


@@ -97,9 +97,9 @@ export class ProductOrderService extends BaseService {
   *
   *
   * This method sends `application/json;charset=utf-8` and handles request body of type `application/json;charset=utf-8`.
   * This method sends `application/json;charset=utf-8` and handles request body of type `application/json;charset=utf-8`.
   */
   */
  createProductOrder(params: CreateProductOrder$Params, context?: HttpContext): Observable<void> {
  createProductOrder(params: CreateProductOrder$Params, context?: HttpContext): Observable<ProductOrder> {
    return this.createProductOrder$Response(params, context).pipe(
    return this.createProductOrder$Response(params, context).pipe(
      map((r: StrictHttpResponse<void>): void => r.body)
      map((r: StrictHttpResponse<ProductOrder>): ProductOrder => r.body)
    );
    );
  }
  }


+3 −3
Original line number Original line Diff line number Diff line
@@ -5,7 +5,7 @@ import { ProductOffering, ProductSpecificationCharacteristicRes, ProductSpecific
import { Subscription } from 'rxjs';
import { Subscription } from 'rxjs';
import { SortingService } from 'src/app/shared/functions/sorting.service';
import { SortingService } from 'src/app/shared/functions/sorting.service';
import { ToastrService } from 'ngx-toastr';
import { ToastrService } from 'ngx-toastr';
import { ProductOrderCreate, ProductOrderItem } from 'src/app/openApis/productOrderingManagement/models';
import { ProductOrder, ProductOrderCreate, ProductOrderItem } from 'src/app/openApis/productOrderingManagement/models';
import { AuthService } from 'src/app/shared/services/auth.service';
import { AuthService } from 'src/app/shared/services/auth.service';
import { Router } from '@angular/router';
import { Router } from '@angular/router';
import { ProductOrderService } from 'src/app/openApis/productOrderingManagement/services';
import { ProductOrderService } from 'src/app/openApis/productOrderingManagement/services';
@@ -269,7 +269,7 @@ export class ProductOrderCheckoutComponent implements OnInit {




    this.orderService.createProductOrder({ body: newOrder }).subscribe({
    this.orderService.createProductOrder({ body: newOrder }).subscribe({
      next: (createdOrder: any) => {
      next: (createdOrder: ProductOrder) => {
        this.toastr.success("Order Placed Successfully");
        this.toastr.success("Order Placed Successfully");
        
        
        this.orderedSpecsConfigurationList = [];
        this.orderedSpecsConfigurationList = [];