async deletePet()

in ui-angular/src/app/app.component.ts [121:138]


  async deletePet() {

    if (!window.confirm('Are you sure?')) {
      return;
    }
    const pet = this.model.selectedPet;

    if (!pet) {
      this.model.errorMessage = 'Pet is needed';
      return;
    }
    try {
      await this.apiService.deletePet(pet);
      await this.loadAllPets();
    } catch (e) {
      this.model.errorMessage = 'Failed to delete pet. ' + e.message;
    }
  }