0

I have a Angular frontend and Springboot backend generated with jhipster. I have a form where I save a few information. I want to send these to the backend. But there is one problem. I do not get any response from the serve guessing that there is no Request made.

I controlled it via the console from my browser and the network part is empty. When I debug there seems to be no error at all. Because there is no error log I do not know how to solve this problem. COuld someone take a look and maybe give me a advice why this happened.

my ts file:

materialAddForm: FormGroup;
  formData: any;
  @Input()
  materialModel: MaterialModel
  constructor(
    private materialService: MaterialService,

  ) {this.materialModel = new MaterialModel(
    11
  ) }


  ngOnInit() {
  }


  saveMaterial() {
      this.materialService.addMaterial(this.materialModel);
      console.log(this.materialModel)

  }

My service with the backend call:

constructor(
    private http: HttpClient,
  ) { }

  addMaterial(material: MaterialModel): Observable<MaterialModel> {
    return this.http.post(environment.api_server_product_url + 'api/materials-add', material);
    console.log("HALLO RESPONSE")
  }
Hasan Toraman
  • 99
  • 1
  • 17
  • 1
    this.materialService.addMaterial(this.materialModel).subscribe(console.log) – Ihor Yanovchyk Dec 25 '20 at 15:08
  • Hey Thanks both of you, I get now one Cors error and 401 unauthorized. I do not understand both errors. COrs I have to research but the Unauthorized does not make sense, because my production is connected to my jhipgster-gateway and when I login to my frontend application, I should be able to get past all of the services connected to it or is it not like that? – Hasan Toraman Dec 25 '20 at 15:56

0 Answers0