4
2
mirror of https://github.com/getbible/app.git synced 2024-12-21 23:48:53 +00:00

Fixed delete method bug using cursor, fixes #2

This commit is contained in:
Erastus Amunwe 2020-11-03 11:08:24 +02:00
parent 1fbbc54fbd
commit d1ffc57dc3

View File

@ -42,18 +42,22 @@ export default {
};
let store = trans.objectStore(delInfo.name);
console.log("deleting "+ delInfo.keyPath+ " from "+delInfo.name);
let request = store.delete([delInfo.keyPath]);
request.onerror= err => reject(err)
// request.onsuccess = e => console.log(e);
store.openCursor().onsuccess = e => {
let cursor = e.target.result;
if (cursor) {
if(delInfo.keyPath == cursor.value['abbreviation']){
let request =cursor.delete()
request.onsuccess = e => console.log(e);}
cursor.continue();
}
};
trans.onerror = e => {
reject(e)
}
trans.onabort = e => {
reject(e)
}
trans.commit();
});
},