feat: getActions from client plugins to include clientOptions in get user client config (#2333)

* update: `getActions` from client plugins to include `clientOptions` in get user client config

* update: rename `clientOptions` to `options`

* chore: lint
This commit is contained in:
Maxwell
2025-05-09 12:13:57 +10:00
committed by GitHub
parent cb1cbceffc
commit fb130c9ee4
2 changed files with 12 additions and 2 deletions

View File

@@ -100,7 +100,10 @@ export const getClientConfig = (options?: ClientOptions) => {
for (const plugin of plugins) {
if (plugin.getActions) {
Object.assign(pluginsActions, plugin.getActions?.($fetch, $store));
Object.assign(
pluginsActions,
plugin.getActions?.($fetch, $store, options),
);
}
}
return {

View File

@@ -36,7 +36,14 @@ export interface BetterAuthClientPlugin {
/**
* Custom actions
*/
getActions?: ($fetch: BetterFetch, $store: Store) => Record<string, any>;
getActions?: (
$fetch: BetterFetch,
$store: Store,
/**
* better-auth client options
*/
options: ClientOptions | undefined,
) => Record<string, any>;
/**
* State atoms that'll be resolved by each framework
* auth store.