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'; ...@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { MasService } from 'src/app/services/mas.service'; import { MasService } from 'src/app/services/mas.service';
import { NgbModal, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap';
import { Router, ActivatedRouteSnapshot } from '@angular/router' import { Router, ActivatedRouteSnapshot } from '@angular/router'
import { HttpResponse } from '@angular/common/http';
@Component({ @Component({
selector: 'app-overview', selector: 'app-overview',
...@@ -102,14 +103,14 @@ export class OverviewComponent implements OnInit { ...@@ -102,14 +103,14 @@ export class OverviewComponent implements OnInit {
onDeleteMAS(id: string, deleting, deleted) { onDeleteMAS(id: string, deleting, deleted) {
this.modalService.open(deleting, { size: 'sm', centered: true }); this.modalService.open(deleting, { size: 'sm', centered: true });
this.masService.deleteMASById(id).subscribe( this.masService.deleteMASById(id).subscribe(
(res: any) => { (res: HttpResponse<any>) => {
this.router.navigate['/overview']; if (res.status === 200) {
this.modalService.dismissAll();
this.modalService.open(deleted, { size: 'sm', centered: true });
}
}, },
(err) => { (err) => {
this.modalService.dismissAll(); console.log(err)
this.modalService.open(deleted, { size: 'sm', centered: true });
console.log(typeof(deleted));
console.log(err);
} }
); );
} }
......
...@@ -28,7 +28,10 @@ export class WebRequestService { ...@@ -28,7 +28,10 @@ export class WebRequestService {
} }
delete(uri: string) { 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