feat: add optional email and phone fields to hotel model
This commit is contained in:
parent
16b2670642
commit
8c96de6341
2 changed files with 8 additions and 0 deletions
|
@ -6,4 +6,6 @@ export interface Hotel {
|
|||
imageUrl: string;
|
||||
rating: number;
|
||||
tags: Array<string>;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
}
|
||||
|
|
|
@ -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(['/']);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue