This commit is contained in:
Eneko Nieto
2021-02-21 23:38:12 +01:00
parent d36457e0ea
commit 025796bda8
2 changed files with 11 additions and 11 deletions

View File

@@ -4,16 +4,16 @@ import { User, UserId } from './user';
export type TravelId = number;
export class Travel extends TravelDto {
constructor(travelDto: TravelDto) {
super(travelDto.id,
travelDto.driverInfo,
travelDto.travelersInfo,
travelDto.departureDate,
travelDto.origin,
travelDto.destination,
travelDto.places,
travelDto.matrixRoomId,
travelDto.description);
constructor(travelDto: TravelDto = null) {
super(travelDto?.id,
travelDto?.driverInfo,
travelDto?.travelersInfo,
travelDto?.departureDate,
travelDto?.origin,
travelDto?.destination,
travelDto?.places,
travelDto?.matrixRoomId,
travelDto?.description);
}
availablePlaces(): number {

View File

@@ -28,7 +28,7 @@ export class EditTravelComponent implements OnInit {
this.apiService.getTravel(travelId)
.subscribe(res => {
if (res.success) {
this.travel = res.data;
this.travel = new Travel(res.data);
}
else {
console.error('Error getting travel ' + travelId + ': ' + res.error.code + ' ' + res.error.msg);