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

export const getEntry = async (dbName: databaseNames, key: possibleDBKeys) => {
  const db = await getDatabase(dbName);

  const UserId = MyUserManager.getSelectedUserId();

  const tx = db.transaction(dbName, 'readonly');
  const store = tx.objectStore(dbName);

  return await store.get(key);
  //await store.put(value);
  //await tx.done;
};
