diff --git a/web/src/App.tsx b/web/src/App.tsx index d494bfd..e7edba7 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -6,6 +6,7 @@ import LoginPage from "./pages/Login"; import RegisterPage from "./pages/Register"; import { useDbContext } from "./context/db/db"; import { openDB } from "idb"; +import AgreementPage from "./pages/Agreement"; const router = createBrowserRouter([ { @@ -14,7 +15,7 @@ const router = createBrowserRouter([ }, { path: "/agreement", - element: , + element: , }, { path: "/login", @@ -31,11 +32,15 @@ const App: FC = () => { useEffect(() => { const openConnection = async () => { - const conn = await openDB("guard-local", 3); + const dbPromise = openDB("guard-local", 3, { + upgrade: (db) => { + if (!db.objectStoreNames.contains("accounts")) { + db.createObjectStore("accounts", { keyPath: "accountId" }); + } + }, + }); - if (!conn.objectStoreNames.contains("accounts")) { - conn.createObjectStore("accounts", { keyPath: "accountId" }); - } + const conn = await dbPromise; setDb(conn); };