mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
Fix: Correct standalone mode logic and API call
Adjusted the condition for standalone mode to correctly check for `adminOptions` when `serveStatic` is not enabled, ensuring the warning message is displayed appropriately. Updated the `getApi` call to pass optional headers when available, allowing for authenticated API requests with custom headers.
This commit is contained in:
@@ -25,7 +25,7 @@ export function createBknd<Env>(config: AdapterModeWithOptions<Env>, env?: Env)
|
|||||||
async function getApp(): Promise<App> {
|
async function getApp(): Promise<App> {
|
||||||
if (!appPromise) {
|
if (!appPromise) {
|
||||||
if (mode === "standalone") {
|
if (mode === "standalone") {
|
||||||
if (!options.serveStatic && !options.adminOptions) {
|
if (options.adminOptions && !options.serveStatic) {
|
||||||
$console.warn(
|
$console.warn(
|
||||||
"adminOptions provided without serveStatic — admin UI assets may not be served. " +
|
"adminOptions provided without serveStatic — admin UI assets may not be served. " +
|
||||||
"See `serveStatic`, `serveStaticViaImport`, or add a `package.json` script that runs `bknd copy-assets --out {relative_static_assets_directory_path}`.",
|
"See `serveStatic`, `serveStaticViaImport`, or add a `package.json` script that runs `bknd copy-assets --out {relative_static_assets_directory_path}`.",
|
||||||
@@ -46,7 +46,7 @@ export function createBknd<Env>(config: AdapterModeWithOptions<Env>, env?: Env)
|
|||||||
await api.verifyAuth();
|
await api.verifyAuth();
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
return app.getApi();
|
return app.getApi(opts?.headers ? { headers: opts.headers } : undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
function serve() {
|
function serve() {
|
||||||
|
|||||||
Reference in New Issue
Block a user