Commit d61a49c9 authored by Qianwen's avatar Qianwen
Browse files

correct delete response

parent fe7ddfb6
......@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { MasService } from 'src/app/services/mas.service';
import { NgbModal, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap';
import { Router, ActivatedRouteSnapshot } from '@angular/router'
import { HttpResponse } from '@angular/common/http';
@Component({
selector: 'app-overview',
......@@ -102,14 +103,14 @@ export class OverviewComponent implements OnInit {
onDeleteMAS(id: string, deleting, deleted) {
this.modalService.open(deleting, { size: 'sm', centered: true });
this.masService.deleteMASById(id).subscribe(
(res: any) => {
this.router.navigate['/overview'];
(res: HttpResponse<any>) => {
if (res.status === 200) {
this.modalService.dismissAll();
this.modalService.open(deleted, { size: 'sm', centered: true });
}
},
(err) => {
this.modalService.dismissAll();
this.modalService.open(deleted, { size: 'sm', centered: true });
console.log(typeof(deleted));
console.log(err);
console.log(err)
}
);
}
......
......@@ -28,7 +28,10 @@ export class WebRequestService {
}
delete(uri: string) {
return this.http.delete(`${this.ROOT_URL}/${uri}`);
return this.http.delete(`${this.ROOT_URL}/${uri}`, {
observe: 'response',
responseType: 'text'
});
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment