feat: refactor db context

This commit is contained in:
2025-05-24 20:58:36 +02:00
parent 65545a0d71
commit ae07d2d3d9
2 changed files with 1 additions and 1 deletions

View File

@ -0,0 +1,16 @@
import type { IDBPDatabase } from "idb";
import { createContext, useContext } from "react";
interface DbContextValues {
db: IDBPDatabase | null;
connected: boolean;
setDb: (db: IDBPDatabase) => void;
}
export const DbContext = createContext<DbContextValues>({
db: null,
connected: false,
setDb: () => {},
});
export const useDbContext = () => useContext(DbContext);