'indexedDB wrapper Dexie

This is my angular code to insert into the BD. The problem is sometimes, it fails to add the value.

addNewImage(imgName:string, imgDataVal:any) {
    db.imageList.put({
      imgName: imgName,
      imgDataUrlValue:imgDataVal
    }).then((r)=>{
      if(r===1) {
        console.log("successfully added");
      }
    },
      (err)=>{
        console.log("Failed to add");
      })
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source