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) => {
const tempDataSource = [];
if (newTableDataSource === null) {
if (newTableDataSource == null) {
return;
}
this.reloadingTable = false;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save