#Removing pdf file, do not reach the function

10 messages · Page 1 of 1 (latest)

strange glen
#

Do you do anything with the removePdf method on the front end? IIRC, Angular's http service uses observables

quiet mist
#

You mean with my function in client?

remove(): void {
    this.saleService.getinvoice(this.id!).subscribe((response: MySales) => {
      const filename = response.facnr + 'VF.pdf';
      this.fileservice.removePdf(filename);
    });
    this.saleService.removeInvoice(this.id!).subscribe({
      next: () => {
        this.saleService.getinvoices().subscribe((response: Response) => {
          this.toast.showToast(
            TOAST_STATE.success,
            'Succesvol verwijderen van factuurnummer: ' +
              this.detailForm.get('facnr')?.value +
              '!'
          );
          this.router.navigate(['invoicing/sales']);
        });
      },
      error: (error) =>
        this.toast.showToast(
          TOAST_STATE.success,
          'Er is iets mis gegaan: ' + error
        ),
    });
    this.dismissError();
  }```
strange glen
#

Yeah, I believe you'll need to subscribe to that remove pdf call

quiet mist
#

ima try it give me minut

strange glen
#

Otherwise, as it's an observable, it'll never actually be called

quiet mist
#

i tried, it still does not remove them

strange glen
#

Okay. Does your server actually get called? Do you have any errors on the server? You said this worked from postman, right?

quiet mist
#

so i get in this function but from there it does not call the api, i dont understand why is that

#

well i got it

#

it was the subscribe u said