- fix Indexdb:

1) ReadAllData 'GET'  : OK
 2) InsertTodo 'POST'  : OK
 3) DeleteItem 'DELETE': OK
 4) Modify     'PATCH' : OK
This commit is contained in:
Paolo Arena
2019-02-03 00:51:58 +01:00
parent 185bd2657d
commit 5db5fb7dd0
5 changed files with 77 additions and 65 deletions

View File

@@ -64,26 +64,20 @@ export let idbKeyval = (() => {
return req.result;
},
async set(key, value) {
return await withStore('readwrite', 'keyval', store => {
store.put(value, key);
let req;
await withStore('readwrite', 'keyval', store => {
req = store.put(value, key);
});
return req.result;
},
async setdata(table, valuekey) {
// set only the ID, because it need to delete it
let value = []
if (table === 'delete_todos') {
value['_id'] = valuekey
value['value'] = valuekey
}else {
value = valuekey
}
async setdata(table, value) {
let req;
console.log('setdata', table, value)
return await withStore('readwrite', table, store => {
store.put(value);
await withStore('readwrite', table, store => {
req = store.put(value);
});
return req.result;
},
async delete(key) {
return await withStore('readwrite', 'keyval', store => {