fix: expose client fetch and signed adjustments
This commit is contained in:
1 parent
6258495b67
commit
4be4b2c346
8 files changed
+64
-8
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@wrnexus/csr",
|
||||
"version": "0.8.31",
|
||||
"version": "0.8.32",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
|
||||
@@ -19,6 +19,21 @@ export { ACTION_RUNTIME } from "./action-runtime.ts";
|
||||
export { createApiClient } from "./api-client.ts";
|
||||
export type { ApiClientOptions, ApiRequest } from "./api-client.ts";
|
||||
|
||||
/** Public client transport used by `.wrn` client functions for dynamic URLs. */
|
||||
export function useFetch<T = unknown>(
|
||||
path: string,
|
||||
methodOrOptions?:
|
||||
string | { method?: string; query?: unknown; params?: unknown; body?: unknown; data?: unknown },
|
||||
input?: unknown,
|
||||
): Promise<T> {
|
||||
const client = (
|
||||
globalThis as typeof globalThis & { useFetch?: (...args: unknown[]) => Promise<T> }
|
||||
).useFetch;
|
||||
if (!client)
|
||||
return Promise.reject(new Error("WRN-CSR: useFetch is only available in the browser runtime"));
|
||||
return client(path, methodOrOptions, input);
|
||||
}
|
||||
|
||||
const CONTROLLER_SECTIONS = ["PRIMARY", "UI", "PIN"] as const;
|
||||
|
||||
function runtimeForMode(development: boolean): string {
|
||||
|
||||
Reference in new issue
Block a user