e
This commit is contained in:
parent
e74620f2f0
commit
cb5c9c2191
1 changed files with 3 additions and 0 deletions
|
@ -63,15 +63,18 @@ function toggleLightDark(transaction){
|
||||||
return new Promise((res)=>{
|
return new Promise((res)=>{
|
||||||
const obj_store = transaction.objectStore("light-dark-store");
|
const obj_store = transaction.objectStore("light-dark-store");
|
||||||
const grab = obj_store.get(1);
|
const grab = obj_store.get(1);
|
||||||
|
grab.onerror = ()=>{console.error("grab error");res();};
|
||||||
grab.onsuccess = (event)=>{
|
grab.onsuccess = (event)=>{
|
||||||
const val = event.result;
|
const val = event.result;
|
||||||
if(val){
|
if(val){
|
||||||
const yeet = obj_store.delete(1);
|
const yeet = obj_store.delete(1);
|
||||||
yeet.onsuccess = res;
|
yeet.onsuccess = res;
|
||||||
|
yeet.onerror = ()=>{console.error("yeet error");res();};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const plonk = obj_store.add({id:1}, 1);
|
const plonk = obj_store.add({id:1}, 1);
|
||||||
plonk.onsuccess = res;
|
plonk.onsuccess = res;
|
||||||
|
plonk.onerror = ()=>{console.error("plonk error");res();};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue