feat: add local auth support if api storage provided

This commit is contained in:
dswbx
2025-12-02 18:18:45 +01:00
parent 506c7d84cc
commit acc10377ca
20 changed files with 193 additions and 174 deletions

View File

@@ -1,7 +1,8 @@
import { boolean, em, entity, text } from "bknd";
import { Route } from "wouter";
import IndexPage from "~/routes/_index";
import { BkndBrowserApp, type BrowserBkndConfig } from "bknd/adapter/browser";
import { BkndBrowserApp, type BrowserBkndConfig, useApp } from "bknd/adapter/browser";
import { type ReactNode, useEffect } from "react";
const schema = em({
todos: entity("todos", {
@@ -49,8 +50,17 @@ const config = {
export default function App() {
return (
<BkndBrowserApp {...config}>
<BkndBrowserApp {...config} header={<Debug />}>
<Route path="/" component={IndexPage} />
</BkndBrowserApp>
);
}
const Debug = () => {
const { app } = useApp();
useEffect(() => {
// @ts-ignore
window.app = app;
}, [app]);
return null;
};

View File

@@ -10,24 +10,8 @@ export default defineConfig({
optimizeDeps: {
exclude: ["sqlocal"],
},
resolve: {
dedupe: ["react", "react-dom"],
},
plugins: [
sqlocal(),
react(),
tailwindcss(),
tsconfigPaths(),
/* {
name: "configure-response-headers",
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
next();
});
},
}, */
],
plugins: [sqlocal(), react(), tailwindcss(), tsconfigPaths()],
});