Fix bug when result is null

master
Max 4 years ago
parent 67ea803bd0
commit e463f64b0d

@ -163,7 +163,7 @@ export class TableComponent implements AfterViewInit {
this.dataService.tableData.subscribe((newTableDataSource) => { this.dataService.tableData.subscribe((newTableDataSource) => {
const tempDataSource = []; const tempDataSource = [];
if (newTableDataSource === null) { if (newTableDataSource == null) {
return; return;
} }
this.reloadingTable = false; this.reloadingTable = false;

@ -56,7 +56,7 @@ export class BikeEventsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getBikeEventsGQL.fetch().subscribe((result) => { this.getBikeEventsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.bikeEvents); this.tableData.next(result?.data?.bikeEvents);
}); });
} }
@ -66,7 +66,7 @@ export class BikeEventsService {
this.getBikeEventByIdGQL this.getBikeEventByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.bikeEventById); this.pageData.next(result?.data?.bikeEventById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class BikeEventsService {
this.reloadBikeEventByIdGQL this.reloadBikeEventByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.bikeEventById); this.updateDataRowFromResponse(result?.data?.bikeEventById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class BikeEventsService {
createBikeEvent(currentId: string, variables: CreateBikeEventMutationVariables) { createBikeEvent(currentId: string, variables: CreateBikeEventMutationVariables) {
this.createBikeEventGQL.mutate(variables).subscribe((result) => { this.createBikeEventGQL.mutate(variables).subscribe((result) => {
const newBikeEvent = result.data.createBikeEvent; const newBikeEvent = result?.data?.createBikeEvent;
this.tableData.next([newBikeEvent, ...this.tableData.value]); this.tableData.next([newBikeEvent, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class BikeEventsService {
this.updateBikeEventGQL this.updateBikeEventGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateBikeEvent); this.updateDataRowFromResponse(result?.data?.updateBikeEvent);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.bikeEvent.id); this.removeLoadingRowId(variables.bikeEvent.id);
@ -110,7 +110,7 @@ export class BikeEventsService {
this.lockBikeEventGQL this.lockBikeEventGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockBikeEvent); this.updateDataRowFromResponse(result?.data?.lockBikeEvent);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class BikeEventsService {
this.unlockBikeEventGQL this.unlockBikeEventGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockBikeEvent); this.updateDataRowFromResponse(result?.data?.unlockBikeEvent);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class BikeEventsService {
this.deleteBikeEventGQL this.deleteBikeEventGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bikeEvent) => bikeEvent.id !== variables.id) [...this.tableData.value].filter((bikeEvent) => bikeEvent.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class BikeEventTypesService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getBikeEventTypesGQL.fetch().subscribe((result) => { this.getBikeEventTypesGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.bikeEventTypes); this.tableData.next(result?.data?.bikeEventTypes);
}); });
} }
create(currentId: string, variables: CreateBikeEventTypeMutationVariables) { create(currentId: string, variables: CreateBikeEventTypeMutationVariables) {
this.createBikeEventTypeGQL.mutate(variables).subscribe((result) => { this.createBikeEventTypeGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createBikeEventType; const newRow = result?.data?.createBikeEventType;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class BikeEventTypesService {
this.updateBikeEventTypeGQL this.updateBikeEventTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateBikeEventType); this.updateDataRowFromResponse(result?.data?.updateBikeEventType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.bikeEventType.id); this.removeLoadingRowId(variables.bikeEventType.id);
@ -79,7 +79,7 @@ export class BikeEventTypesService {
this.lockBikeEventTypeGQL this.lockBikeEventTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockBikeEventType); this.updateDataRowFromResponse(result?.data?.lockBikeEventType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class BikeEventTypesService {
this.unlockBikeEventTypeGQL this.unlockBikeEventTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockBikeEventType); this.updateDataRowFromResponse(result?.data?.unlockBikeEventType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class BikeEventTypesService {
this.deleteBikeEventTypeGQL this.deleteBikeEventTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -59,7 +59,7 @@ export class BikesService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getCargoBikesGQL.fetch().subscribe((result) => { this.getCargoBikesGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.cargoBikes); this.tableData.next(result?.data?.cargoBikes);
}); });
} }
@ -69,7 +69,7 @@ export class BikesService {
this.getCargoBikeByIdGQL this.getCargoBikeByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.cargoBikeById); this.pageData.next(result?.data?.cargoBikeById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -81,7 +81,7 @@ export class BikesService {
this.copyCargoBikeByIdGQL this.copyCargoBikeByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
const newBike = result.data.copyCargoBikeById; const newBike = result?.data?.copyCargoBikeById;
newBike["newObject"] = true; newBike["newObject"] = true;
const currentTableData = this.tableData.getValue(); const currentTableData = this.tableData.getValue();
this.tableData.next([newBike, ...this.tableData.getValue()]); this.tableData.next([newBike, ...this.tableData.getValue()]);
@ -94,7 +94,7 @@ export class BikesService {
this.reloadCargoBikeByIdGQL this.reloadCargoBikeByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.cargoBikeById); this.updateDataRowFromResponse(result?.data?.cargoBikeById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class BikesService {
createBike(currentId: string, variables: CreateCargoBikeMutationVariables) { createBike(currentId: string, variables: CreateCargoBikeMutationVariables) {
this.createCargoBikeGQL.mutate(variables).subscribe((result) => { this.createCargoBikeGQL.mutate(variables).subscribe((result) => {
const newBike = result.data.createCargoBike; const newBike = result?.data?.createCargoBike;
this.tableData.next([newBike, ...this.tableData.value]); this.tableData.next([newBike, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -114,7 +114,7 @@ export class BikesService {
this.updateCargoBikeGQL this.updateCargoBikeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateCargoBike); this.updateDataRowFromResponse(result?.data?.updateCargoBike);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.bike.id); this.removeLoadingRowId(variables.bike.id);
@ -126,7 +126,7 @@ export class BikesService {
this.lockCargoBikeGQL this.lockCargoBikeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockCargoBike); this.updateDataRowFromResponse(result?.data?.lockCargoBike);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -138,7 +138,7 @@ export class BikesService {
this.unlockCargoBikeGQL this.unlockCargoBikeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockCargoBike); this.updateDataRowFromResponse(result?.data?.unlockCargoBike);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -150,7 +150,7 @@ export class BikesService {
this.deleteCargoBikeGQL this.deleteCargoBikeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class ContactInformationService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getContactInformationGQL.fetch().subscribe((result) => { this.getContactInformationGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.contactInformation); this.tableData.next(result?.data?.contactInformation);
}); });
} }
createContactInformation(currentId: string, variables: CreateContactInformationMutationVariables) { createContactInformation(currentId: string, variables: CreateContactInformationMutationVariables) {
this.createContactInformationGQL.mutate(variables).subscribe((result) => { this.createContactInformationGQL.mutate(variables).subscribe((result) => {
const newContactInformation = result.data.createContactInformation; const newContactInformation = result?.data?.createContactInformation;
this.tableData.next([newContactInformation, ...this.tableData.value]); this.tableData.next([newContactInformation, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class ContactInformationService {
this.updateContactInformationGQL this.updateContactInformationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateContactInformation); this.updateDataRowFromResponse(result?.data?.updateContactInformation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.contactInformation.id); this.removeLoadingRowId(variables.contactInformation.id);
@ -79,7 +79,7 @@ export class ContactInformationService {
this.lockContactInformationGQL this.lockContactInformationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockContactInformation); this.updateDataRowFromResponse(result?.data?.lockContactInformation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class ContactInformationService {
this.unlockContactInformationGQL this.unlockContactInformationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockContactInformation); this.updateDataRowFromResponse(result?.data?.unlockContactInformation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class ContactInformationService {
this.deleteContactInformationGQL this.deleteContactInformationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((contactInformation) => contactInformation.id !== variables.id) [...this.tableData.value].filter((contactInformation) => contactInformation.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class EngagementsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getEngagementsGQL.fetch().subscribe((result) => { this.getEngagementsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.engagements); this.tableData.next(result?.data?.engagements);
}); });
} }
create(currentId: string, variables: CreateEngagementMutationVariables) { create(currentId: string, variables: CreateEngagementMutationVariables) {
this.createEngagementGQL.mutate(variables).subscribe((result) => { this.createEngagementGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createEngagement; const newRow = result?.data?.createEngagement;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class EngagementsService {
this.updateEngagementGQL this.updateEngagementGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateEngagement); this.updateDataRowFromResponse(result?.data?.updateEngagement);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.engagement.id); this.removeLoadingRowId(variables.engagement.id);
@ -79,7 +79,7 @@ export class EngagementsService {
this.lockEngagementGQL this.lockEngagementGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockEngagement); this.updateDataRowFromResponse(result?.data?.lockEngagement);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class EngagementsService {
this.unlockEngagementGQL this.unlockEngagementGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockEngagement); this.updateDataRowFromResponse(result?.data?.unlockEngagement);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class EngagementsService {
this.deleteEngagementGQL this.deleteEngagementGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class EngagementTypesService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getEngagementTypesGQL.fetch().subscribe((result) => { this.getEngagementTypesGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.engagementTypes); this.tableData.next(result?.data?.engagementTypes);
}); });
} }
create(currentId: string, variables: CreateEngagementTypeMutationVariables) { create(currentId: string, variables: CreateEngagementTypeMutationVariables) {
this.createEngagementTypeGQL.mutate(variables).subscribe((result) => { this.createEngagementTypeGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createEngagementType; const newRow = result?.data?.createEngagementType;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class EngagementTypesService {
this.updateEngagementTypeGQL this.updateEngagementTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateEngagementType); this.updateDataRowFromResponse(result?.data?.updateEngagementType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.engagementType.id); this.removeLoadingRowId(variables.engagementType.id);
@ -79,7 +79,7 @@ export class EngagementTypesService {
this.lockEngagementTypeGQL this.lockEngagementTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockEngagementType); this.updateDataRowFromResponse(result?.data?.lockEngagementType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class EngagementTypesService {
this.unlockEngagementTypeGQL this.unlockEngagementTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockEngagementType); this.updateDataRowFromResponse(result?.data?.unlockEngagementType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class EngagementTypesService {
this.deleteEngagementTypeGQL this.deleteEngagementTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class EquipmentService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getEquipmentsGQL.fetch().subscribe((result) => { this.getEquipmentsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.equipment); this.tableData.next(result?.data?.equipment);
}); });
} }
create(currentId: string, variables: CreateEquipmentMutationVariables) { create(currentId: string, variables: CreateEquipmentMutationVariables) {
this.createEquipmentGQL.mutate(variables).subscribe((result) => { this.createEquipmentGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createEquipment; const newRow = result?.data?.createEquipment;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class EquipmentService {
this.updateEquipmentGQL this.updateEquipmentGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateEquipment); this.updateDataRowFromResponse(result?.data?.updateEquipment);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.equipmentType.id); this.removeLoadingRowId(variables.equipmentType.id);
@ -79,7 +79,7 @@ export class EquipmentService {
this.lockEquipmentGQL this.lockEquipmentGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockEquipment); this.updateDataRowFromResponse(result?.data?.lockEquipment);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class EquipmentService {
this.unlockEquipmentGQL this.unlockEquipmentGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockEquipment); this.updateDataRowFromResponse(result?.data?.unlockEquipment);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class EquipmentService {
this.deleteEquipmentGQL this.deleteEquipmentGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class EquipmentTypeService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getEquipmentTypesGQL.fetch().subscribe((result) => { this.getEquipmentTypesGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.equipmentTypes); this.tableData.next(result?.data?.equipmentTypes);
}); });
} }
create(currentId: string, variables: CreateEquipmentTypeMutationVariables) { create(currentId: string, variables: CreateEquipmentTypeMutationVariables) {
this.createEquipmentTypeGQL.mutate(variables).subscribe((result) => { this.createEquipmentTypeGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createEquipmentType; const newRow = result?.data?.createEquipmentType;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class EquipmentTypeService {
this.updateEquipmentTypeGQL this.updateEquipmentTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateEquipmentType); this.updateDataRowFromResponse(result?.data?.updateEquipmentType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.equipmentType.id); this.removeLoadingRowId(variables.equipmentType.id);
@ -79,7 +79,7 @@ export class EquipmentTypeService {
this.lockEquipmentTypeGQL this.lockEquipmentTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockEquipmentType); this.updateDataRowFromResponse(result?.data?.lockEquipmentType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class EquipmentTypeService {
this.unlockEquipmentTypeGQL this.unlockEquipmentTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockEquipmentType); this.updateDataRowFromResponse(result?.data?.unlockEquipmentType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class EquipmentTypeService {
this.deleteEquipmentTypeGQL this.deleteEquipmentTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -56,7 +56,7 @@ export class LendingStationsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getLendingStationsGQL.fetch().subscribe((result) => { this.getLendingStationsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.lendingStations); this.tableData.next(result?.data?.lendingStations);
}); });
} }
@ -66,7 +66,7 @@ export class LendingStationsService {
this.getLendingStationByIdGQL this.getLendingStationByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.lendingStationById); this.pageData.next(result?.data?.lendingStationById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class LendingStationsService {
this.reloadLendingStationByIdGQL this.reloadLendingStationByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lendingStationById); this.updateDataRowFromResponse(result?.data?.lendingStationById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class LendingStationsService {
createLendingStation(currentId: string, variables: CreateLendingStationMutationVariables) { createLendingStation(currentId: string, variables: CreateLendingStationMutationVariables) {
this.createLendingStationGQL.mutate(variables).subscribe((result) => { this.createLendingStationGQL.mutate(variables).subscribe((result) => {
const newLendingStation = result.data.createLendingStation; const newLendingStation = result?.data?.createLendingStation;
this.tableData.next([newLendingStation, ...this.tableData.value]); this.tableData.next([newLendingStation, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class LendingStationsService {
this.updateLendingStationGQL this.updateLendingStationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateLendingStation); this.updateDataRowFromResponse(result?.data?.updateLendingStation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.lendingStation.id); this.removeLoadingRowId(variables.lendingStation.id);
@ -110,7 +110,7 @@ export class LendingStationsService {
this.lockLendingStationGQL this.lockLendingStationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockLendingStation); this.updateDataRowFromResponse(result?.data?.lockLendingStation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class LendingStationsService {
this.unlockLendingStationGQL this.unlockLendingStationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockLendingStation); this.updateDataRowFromResponse(result?.data?.unlockLendingStation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class LendingStationsService {
this.deleteLendingStationGQL this.deleteLendingStationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((lendingStation) => lendingStation.id !== variables.id) [...this.tableData.value].filter((lendingStation) => lendingStation.id !== variables.id)
); );

@ -56,7 +56,7 @@ export class OrganisationsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getOrganisationsGQL.fetch().subscribe((result) => { this.getOrganisationsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.organisations); this.tableData.next(result?.data?.organisations);
}); });
} }
@ -66,7 +66,7 @@ export class OrganisationsService {
this.getOrganisationByIdGQL this.getOrganisationByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.organisationById); this.pageData.next(result?.data?.organisationById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class OrganisationsService {
this.reloadOrganisationByIdGQL this.reloadOrganisationByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.organisationById); this.updateDataRowFromResponse(result?.data?.organisationById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class OrganisationsService {
createOrganisation(currentId: string, variables: CreateOrganisationMutationVariables) { createOrganisation(currentId: string, variables: CreateOrganisationMutationVariables) {
this.createOrganisationGQL.mutate(variables).subscribe((result) => { this.createOrganisationGQL.mutate(variables).subscribe((result) => {
const newOrganisation = result.data.createOrganisation; const newOrganisation = result?.data?.createOrganisation;
this.tableData.next([newOrganisation, ...this.tableData.value]); this.tableData.next([newOrganisation, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class OrganisationsService {
this.updateOrganisationGQL this.updateOrganisationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateOrganisation); this.updateDataRowFromResponse(result?.data?.updateOrganisation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.organisation.id); this.removeLoadingRowId(variables.organisation.id);
@ -110,7 +110,7 @@ export class OrganisationsService {
this.lockOrganisationGQL this.lockOrganisationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockOrganisation); this.updateDataRowFromResponse(result?.data?.lockOrganisation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class OrganisationsService {
this.unlockOrganisationGQL this.unlockOrganisationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockOrganisation); this.updateDataRowFromResponse(result?.data?.unlockOrganisation);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class OrganisationsService {
this.deleteOrganisationGQL this.deleteOrganisationGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((organisation) => organisation.id !== variables.id) [...this.tableData.value].filter((organisation) => organisation.id !== variables.id)
); );

@ -56,7 +56,7 @@ export class ParticipantsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getParticipantsGQL.fetch().subscribe((result) => { this.getParticipantsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.participants); this.tableData.next(result?.data?.participants);
}); });
} }
@ -66,7 +66,7 @@ export class ParticipantsService {
this.getParticipantByIdGQL this.getParticipantByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.participantById); this.pageData.next(result?.data?.participantById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class ParticipantsService {
this.reloadParticipantByIdGQL this.reloadParticipantByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.participantById); this.updateDataRowFromResponse(result?.data?.participantById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class ParticipantsService {
createParticipant(currentId: string, variables: CreateParticipantMutationVariables) { createParticipant(currentId: string, variables: CreateParticipantMutationVariables) {
this.createParticipantGQL.mutate(variables).subscribe((result) => { this.createParticipantGQL.mutate(variables).subscribe((result) => {
const newParticipant = result.data.createParticipant; const newParticipant = result?.data?.createParticipant;
this.tableData.next([newParticipant, ...this.tableData.value]); this.tableData.next([newParticipant, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class ParticipantsService {
this.updateParticipantGQL this.updateParticipantGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateParticipant); this.updateDataRowFromResponse(result?.data?.updateParticipant);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.participant.id); this.removeLoadingRowId(variables.participant.id);
@ -110,7 +110,7 @@ export class ParticipantsService {
this.lockParticipantGQL this.lockParticipantGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockParticipant); this.updateDataRowFromResponse(result?.data?.lockParticipant);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class ParticipantsService {
this.unlockParticipantGQL this.unlockParticipantGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockParticipant); this.updateDataRowFromResponse(result?.data?.unlockParticipant);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class ParticipantsService {
this.deleteParticipantGQL this.deleteParticipantGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((participant) => participant.id !== variables.id) [...this.tableData.value].filter((participant) => participant.id !== variables.id)
); );

@ -56,7 +56,7 @@ export class PersonsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getPersonsGQL.fetch().subscribe((result) => { this.getPersonsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.persons); this.tableData.next(result?.data?.persons);
}); });
} }
@ -66,7 +66,7 @@ export class PersonsService {
this.getPersonByIdGQL this.getPersonByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.personById); this.pageData.next(result?.data?.personById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class PersonsService {
this.reloadPersonByIdGQL this.reloadPersonByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.personById); this.updateDataRowFromResponse(result?.data?.personById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class PersonsService {
createPerson(currentId: string, variables: CreatePersonMutationVariables) { createPerson(currentId: string, variables: CreatePersonMutationVariables) {
this.createPersonGQL.mutate(variables).subscribe((result) => { this.createPersonGQL.mutate(variables).subscribe((result) => {
const newPerson = result.data.createPerson; const newPerson = result?.data?.createPerson;
this.tableData.next([newPerson, ...this.tableData.value]); this.tableData.next([newPerson, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class PersonsService {
this.updatePersonGQL this.updatePersonGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updatePerson); this.updateDataRowFromResponse(result?.data?.updatePerson);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.person.id); this.removeLoadingRowId(variables.person.id);
@ -110,7 +110,7 @@ export class PersonsService {
this.lockPersonGQL this.lockPersonGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockPerson); this.updateDataRowFromResponse(result?.data?.lockPerson);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class PersonsService {
this.unlockPersonGQL this.unlockPersonGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockPerson); this.updateDataRowFromResponse(result?.data?.unlockPerson);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class PersonsService {
this.deletePersonGQL this.deletePersonGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((person) => person.id !== variables.id) [...this.tableData.value].filter((person) => person.id !== variables.id)
); );

@ -56,7 +56,7 @@ export class ProvidersService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getProvidersGQL.fetch().subscribe((result) => { this.getProvidersGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.providers); this.tableData.next(result?.data?.providers);
}); });
} }
@ -66,7 +66,7 @@ export class ProvidersService {
this.getProviderByIdGQL this.getProviderByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.providerById); this.pageData.next(result?.data?.providerById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class ProvidersService {
this.reloadProviderByIdGQL this.reloadProviderByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.providerById); this.updateDataRowFromResponse(result?.data?.providerById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class ProvidersService {
createProvider(currentId: string, variables: CreateProviderMutationVariables) { createProvider(currentId: string, variables: CreateProviderMutationVariables) {
this.createProviderGQL.mutate(variables).subscribe((result) => { this.createProviderGQL.mutate(variables).subscribe((result) => {
const newProvider = result.data.createProvider; const newProvider = result?.data?.createProvider;
this.tableData.next([newProvider, ...this.tableData.value]); this.tableData.next([newProvider, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class ProvidersService {
this.updateProviderGQL this.updateProviderGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateProvider); this.updateDataRowFromResponse(result?.data?.updateProvider);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.provider.id); this.removeLoadingRowId(variables.provider.id);
@ -110,7 +110,7 @@ export class ProvidersService {
this.lockProviderGQL this.lockProviderGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockProvider); this.updateDataRowFromResponse(result?.data?.lockProvider);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class ProvidersService {
this.unlockProviderGQL this.unlockProviderGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockProvider); this.updateDataRowFromResponse(result?.data?.unlockProvider);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class ProvidersService {
this.deleteProviderGQL this.deleteProviderGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((provider) => provider.id !== variables.id) [...this.tableData.value].filter((provider) => provider.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class TimeFrameService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getTimeFramesGQL.fetch().subscribe((result) => { this.getTimeFramesGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.timeFrames); this.tableData.next(result?.data?.timeFrames);
}); });
} }
create(currentId: string, variables: CreateTimeFrameMutationVariables) { create(currentId: string, variables: CreateTimeFrameMutationVariables) {
this.createTimeFrameGQL.mutate(variables).subscribe((result) => { this.createTimeFrameGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createTimeFrame; const newRow = result?.data?.createTimeFrame;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class TimeFrameService {
this.updateTimeFrameGQL this.updateTimeFrameGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateTimeFrame); this.updateDataRowFromResponse(result?.data?.updateTimeFrame);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.timeFrame.id); this.removeLoadingRowId(variables.timeFrame.id);
@ -79,7 +79,7 @@ export class TimeFrameService {
this.lockTimeFrameGQL this.lockTimeFrameGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockTimeFrame); this.updateDataRowFromResponse(result?.data?.lockTimeFrame);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class TimeFrameService {
this.unlockTimeFrameGQL this.unlockTimeFrameGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockTimeFrame); this.updateDataRowFromResponse(result?.data?.unlockTimeFrame);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class TimeFrameService {
this.deleteTimeFrameGQL this.deleteTimeFrameGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

@ -56,7 +56,7 @@ export class WorkshopsService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getWorkshopsGQL.fetch().subscribe((result) => { this.getWorkshopsGQL.fetch().subscribe((result) => {
this.tableData.next(result.data?.workshops); this.tableData.next(result?.data?.workshops);
}); });
} }
@ -66,7 +66,7 @@ export class WorkshopsService {
this.getWorkshopByIdGQL this.getWorkshopByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.pageData.next(result.data.workshopById); this.pageData.next(result?.data?.workshopById);
}) })
.add(() => { .add(() => {
this.isLoadingPageData.next(false); this.isLoadingPageData.next(false);
@ -78,7 +78,7 @@ export class WorkshopsService {
this.reloadWorkshopByIdGQL this.reloadWorkshopByIdGQL
.fetch(variables) .fetch(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.workshopById); this.updateDataRowFromResponse(result?.data?.workshopById);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -87,7 +87,7 @@ export class WorkshopsService {
createWorkshop(currentId: string, variables: CreateWorkshopMutationVariables) { createWorkshop(currentId: string, variables: CreateWorkshopMutationVariables) {
this.createWorkshopGQL.mutate(variables).subscribe((result) => { this.createWorkshopGQL.mutate(variables).subscribe((result) => {
const newWorkshop = result.data.createWorkshop; const newWorkshop = result?.data?.createWorkshop;
this.tableData.next([newWorkshop, ...this.tableData.value]); this.tableData.next([newWorkshop, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -98,7 +98,7 @@ export class WorkshopsService {
this.updateWorkshopGQL this.updateWorkshopGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateWorkshop); this.updateDataRowFromResponse(result?.data?.updateWorkshop);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.workshop.id); this.removeLoadingRowId(variables.workshop.id);
@ -110,7 +110,7 @@ export class WorkshopsService {
this.lockWorkshopGQL this.lockWorkshopGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockWorkshop); this.updateDataRowFromResponse(result?.data?.lockWorkshop);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -122,7 +122,7 @@ export class WorkshopsService {
this.unlockWorkshopGQL this.unlockWorkshopGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockWorkshop); this.updateDataRowFromResponse(result?.data?.unlockWorkshop);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -134,7 +134,7 @@ export class WorkshopsService {
this.deleteWorkshopGQL this.deleteWorkshopGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((workshop) => workshop.id !== variables.id) [...this.tableData.value].filter((workshop) => workshop.id !== variables.id)
); );

@ -50,13 +50,13 @@ export class WorkshopTypesService {
loadTableData() { loadTableData() {
this.tableData.next(null); this.tableData.next(null);
this.getWorkshopTypesGQL.fetch().subscribe((result) => { this.getWorkshopTypesGQL.fetch().subscribe((result) => {
this.tableData.next(result.data.workshopTypes); this.tableData.next(result?.data?.workshopTypes);
}); });
} }
create(currentId: string, variables: CreateWorkshopTypeMutationVariables) { create(currentId: string, variables: CreateWorkshopTypeMutationVariables) {
this.createWorkshopTypeGQL.mutate(variables).subscribe((result) => { this.createWorkshopTypeGQL.mutate(variables).subscribe((result) => {
const newRow = result.data.createWorkshopType; const newRow = result?.data?.createWorkshopType;
this.tableData.next([newRow, ...this.tableData.value]); this.tableData.next([newRow, ...this.tableData.value]);
this.successfullyCreatedRowWithId.next(currentId); this.successfullyCreatedRowWithId.next(currentId);
}); });
@ -67,7 +67,7 @@ export class WorkshopTypesService {
this.updateWorkshopTypeGQL this.updateWorkshopTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.updateWorkshopType); this.updateDataRowFromResponse(result?.data?.updateWorkshopType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.workshopType.id); this.removeLoadingRowId(variables.workshopType.id);
@ -79,7 +79,7 @@ export class WorkshopTypesService {
this.lockWorkshopTypeGQL this.lockWorkshopTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.lockWorkshopType); this.updateDataRowFromResponse(result?.data?.lockWorkshopType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -91,7 +91,7 @@ export class WorkshopTypesService {
this.unlockWorkshopTypeGQL this.unlockWorkshopTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
this.updateDataRowFromResponse(result.data.unlockWorkshopType); this.updateDataRowFromResponse(result?.data?.unlockWorkshopType);
}) })
.add(() => { .add(() => {
this.removeLoadingRowId(variables.id); this.removeLoadingRowId(variables.id);
@ -103,7 +103,7 @@ export class WorkshopTypesService {
this.deleteWorkshopTypeGQL this.deleteWorkshopTypeGQL
.mutate(variables) .mutate(variables)
.subscribe((result) => { .subscribe((result) => {
if (result.data) { if (result?.data) {
this.tableData.next( this.tableData.next(
[...this.tableData.value].filter((bike) => bike.id !== variables.id) [...this.tableData.value].filter((bike) => bike.id !== variables.id)
); );

Loading…
Cancel
Save