import MyUserManager from '@caj/user/MyUserManager';
import {getDatabase} from './getDB.web';
import {databaseNames} from './types';

export const setEntry = async (dbName: databaseNames, value: any) => {
  const db = await getDatabase(dbName);

  const UserId = MyUserManager.getSelectedUserId();

  const tx = db.transaction(dbName, 'readwrite');
  const store = tx.objectStore(dbName);
  //const val = (await store.get('counter')) || 0;
  await store.put(value);
  await tx.done;
};
