4
2
mirror of https://github.com/getbible/app.git synced 2024-12-22 07:48:55 +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); let store = trans.objectStore(delInfo.name);
console.log("deleting "+ delInfo.keyPath+ " from "+delInfo.name); store.openCursor().onsuccess = e => {
let request = store.delete([delInfo.keyPath]); let cursor = e.target.result;
request.onerror= err => reject(err) if (cursor) {
// request.onsuccess = e => console.log(e); if(delInfo.keyPath == cursor.value['abbreviation']){
let request =cursor.delete()
request.onsuccess = e => console.log(e);}
cursor.continue();
}
};
trans.onerror = e => { trans.onerror = e => {
reject(e) reject(e)
} }
trans.onabort = e => { trans.onabort = e => {
reject(e) reject(e)
} }
trans.commit();
}); });
}, },