Получение внутренней ошибки сервера при удалении при нажатии - PullRequest
0 голосов
/ 01 декабря 2019
ERROR Error Code: 500
Message: Http failure response for http://localhost:4000/api/update/5de40f285e9c793ed4af996c: 500 Internal Server Error

enter image description here

изображение один - API-сервис

enter image description here

Первый блоккод от службы API, и 2-й блок - компонент редактирования

UpdateStudent(id, data: Student): Observable<any> {
        let API_URL = `${this.endpoint}/update/${id}`;
        return this.http.put(API_URL, data, { headers: this.headers }).pipe(
          catchError(this.errorMgmt)
        )
      }

код службы API

updateStudentForm() {
        console.log(this.studentForm.value)
        var id = this.actRoute.snapshot.paramMap.get('id');
        if (window.confirm('Are you sure you want to update?')) {
          this.studentApi.UpdateStudent(id, this.studentForm.value).subscribe(res => {
            this.ngZone.run(() => this.router.navigateByUrl('/students-list'))
          });
        }
      }

    }
...