Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48979

Ionic Storage illegal constructor

$
0
0

Can someone help me regarding the following problem in the database constructor

I get this:

Unhandled Rejection (TypeError): Illegal constructor

at

    initDb();

constructor

const HomeCliente = () => {

  const [db, setDb] = useState<Database | null>(null);

  const runSet = (nombre:any,data:any) => {
    db.set(nombre, data);
  }

  const runGet = async (nombre:any) => {
    return await db.get({nombre});
     
  }




 useEffect(() => {

    async function initDb() {
      const store = new Storage();
  
      const db = await store.create();
  
      setDb(db);
    }
        initDb();

        getItem("primevaCargaProveedores").then(res => {
          primeraVezProveedores.current=res
        })

        runGet("proveedores").then(res => {
          if(res!=undefined || res!=null){
            arreglo=JSON.parse(res)       
          }

        })
      
  }, []);

}

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 48979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>