diff --git a/src/app/HotelItem/hotel.ts b/src/app/HotelItem/hotel.ts index d00db97..a42314c 100644 --- a/src/app/HotelItem/hotel.ts +++ b/src/app/HotelItem/hotel.ts @@ -6,4 +6,6 @@ export interface Hotel { imageUrl: string; rating: number; tags: Array; + email?: string; + phone?: string; } diff --git a/src/app/new-hotel/new-hotel.component.ts b/src/app/new-hotel/new-hotel.component.ts index 8a18010..0fbe3cf 100644 --- a/src/app/new-hotel/new-hotel.component.ts +++ b/src/app/new-hotel/new-hotel.component.ts @@ -127,6 +127,12 @@ export class NewHotelComponent { rating: this.hotelForm.get('rating')?.value, tags: this.hotelForm.get('tags')?.value, }; + + if (this.hotelForm.get('contactType')?.value == 'Email') { + hotel.email = this.hotelForm.get('email')?.value; + } else { + hotel.phone = this.hotelForm.get('phone')?.value; + } this.http.post('/api/hotels/', hotel).subscribe(); this.router.navigate(['/']); }