forked from MapComplete/MapComplete
Attempt to fix #422
This commit is contained in:
parent
b9e15697f4
commit
c26783187b
4 changed files with 55 additions and 29 deletions
|
@ -29,10 +29,11 @@ export class Changes implements FeatureSource {
|
|||
|
||||
/**
|
||||
* All the pending new objects to upload
|
||||
* @private
|
||||
*/
|
||||
private readonly newObjects = LocalStorageSource.GetParsed<{ id: number, lat: number, lon: number }[]>("newObjects", [])
|
||||
|
||||
private readonly isUploading = new UIEventSource(false);
|
||||
|
||||
/**
|
||||
* Adds a change to the pending changes
|
||||
*/
|
||||
|
@ -190,6 +191,12 @@ export class Changes implements FeatureSource {
|
|||
console.log("No changes in any object");
|
||||
return;
|
||||
}
|
||||
const self = this;
|
||||
|
||||
if (this.isUploading.data) {
|
||||
return;
|
||||
}
|
||||
this.isUploading.setData(true)
|
||||
|
||||
console.log("Beginning upload...");
|
||||
// At last, we build the changeset and upload
|
||||
|
@ -235,9 +242,12 @@ export class Changes implements FeatureSource {
|
|||
},
|
||||
() => {
|
||||
console.log("Upload successfull!")
|
||||
this.newObjects.setData([])
|
||||
this.pending.setData([]);
|
||||
});
|
||||
self.newObjects.setData([])
|
||||
self.pending.setData([]);
|
||||
self.isUploading.setData(false)
|
||||
},
|
||||
() => self.isUploading.setData(false)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue