mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-30 10:56:31 -05:00
chore: hook context returned type should be optional
This commit is contained in:
@@ -95,13 +95,11 @@ describe("call", async () => {
|
||||
});
|
||||
}
|
||||
if (query.testContext) {
|
||||
ctx.query = {
|
||||
message: query.testContext,
|
||||
};
|
||||
return {
|
||||
context: {
|
||||
// change context
|
||||
query: {
|
||||
message: query.testContext,
|
||||
},
|
||||
},
|
||||
context: ctx,
|
||||
};
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
APIError,
|
||||
type Endpoint,
|
||||
type EndpointResponse,
|
||||
createEndpointCreator,
|
||||
@@ -25,7 +26,7 @@ export const createAuthMiddleware = createMiddlewareCreator({
|
||||
*/
|
||||
createMiddleware(async () => {
|
||||
return {} as {
|
||||
returned?: unknown;
|
||||
returned?: APIError | Response | Record<string, any>;
|
||||
endpoint: Endpoint;
|
||||
};
|
||||
}),
|
||||
|
||||
@@ -55,7 +55,7 @@ export const betterAuth = <O extends BetterAuthOptions>(options: O) => {
|
||||
user: PrettifyDeep<InferUser<O>>;
|
||||
};
|
||||
} & InferPluginTypes<O>,
|
||||
$ErrorCodes: {
|
||||
$ERROR_CODES: {
|
||||
...errorCodes,
|
||||
...BASE_ERROR_CODES,
|
||||
} as InferPluginErrorCodes<O> & typeof BASE_ERROR_CODES,
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { Ref } from "vue";
|
||||
import type { ReadableAtom } from "nanostores";
|
||||
import type { Session } from "../db/schema";
|
||||
import { BetterFetchError } from "@better-fetch/fetch";
|
||||
import { passkeyClient, twoFactorClient } from "../plugins";
|
||||
import { organizationClient } from "./plugins";
|
||||
import { twoFactorClient } from "../plugins";
|
||||
import { organizationClient, passkeyClient } from "./plugins";
|
||||
|
||||
describe("run time proxy", async () => {
|
||||
it("proxy api should be called", async () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ export type HookEndpointContext<C extends Record<string, any> = {}> =
|
||||
ContextTools & {
|
||||
context: AuthContext &
|
||||
C & {
|
||||
returned: APIError | Response | Record<string, any>;
|
||||
returned?: APIError | Response | Record<string, any>;
|
||||
};
|
||||
} & {
|
||||
body: any;
|
||||
|
||||
Reference in New Issue
Block a user