|
|
@ -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)
|
|
|
|
);
|
|
|
|
);
|
|
|
|