Compare commits
2 commits
c0bc95493a
...
374d4f756a
Author | SHA1 | Date | |
---|---|---|---|
374d4f756a | |||
ee7a4c995f |
4 changed files with 16 additions and 8 deletions
BIN
bun.lockb
BIN
bun.lockb
Binary file not shown.
16
package.json
16
package.json
|
@ -10,14 +10,14 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^18.2.3",
|
"@angular/animations": "^19.0.0",
|
||||||
"@angular/common": "^18.2.3",
|
"@angular/common": "^19.0.0",
|
||||||
"@angular/compiler": "^18.2.3",
|
"@angular/compiler": "^19.0.0",
|
||||||
"@angular/core": "^18.2.3",
|
"@angular/core": "^19.0.0",
|
||||||
"@angular/forms": "^18.2.3",
|
"@angular/forms": "^19.0.0",
|
||||||
"@angular/platform-browser": "^18.2.3",
|
"@angular/platform-browser": "^19.0.0",
|
||||||
"@angular/platform-browser-dynamic": "^18.2.3",
|
"@angular/platform-browser-dynamic": "^19.0.0",
|
||||||
"@angular/router": "^18.2.3",
|
"@angular/router": "^19.0.0",
|
||||||
"angular-in-memory-web-api": "^0.18.0",
|
"angular-in-memory-web-api": "^0.18.0",
|
||||||
"rxjs": "~7.8.0",
|
"rxjs": "~7.8.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@if (hotel != null) {
|
@if (hotel != null) {
|
||||||
<app-hotel-item [hotel]="hotel" [isDetail]="true"></app-hotel-item>
|
<app-hotel-item [hotel]="hotel" [isDetail]="true"></app-hotel-item>
|
||||||
<app-hotel-form [hotel]="hotel"></app-hotel-form>
|
<app-hotel-form [hotel]="hotel"></app-hotel-form>
|
||||||
|
<button (click)="delete()">DELETE</button>
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,13 @@ export class HotelDetailsComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private http: HttpClient, private router: Router) { }
|
constructor(private route: ActivatedRoute, private http: HttpClient, private router: Router) { }
|
||||||
|
|
||||||
|
delete(): void {
|
||||||
|
if (confirm("Are u sure u want to delete this hotel")) {
|
||||||
|
this.http.delete<Hotel>("/api/hotels/" + this.route.snapshot.paramMap.get("id")).subscribe();
|
||||||
|
this.router.navigate(["/"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const routeParams = this.route.snapshot.paramMap;
|
const routeParams = this.route.snapshot.paramMap;
|
||||||
const hotelId = routeParams.get("id");
|
const hotelId = routeParams.get("id");
|
||||||
|
|
Loading…
Add table
Reference in a new issue