- Added `AssignCoursesModal`, `AudienceMemberRow`, `AudienceTable`, and related components for improved audience management UI. - Implemented audience invite actions including resend and revoke functionality. - Updated audience API to support importing members and assigning courses. - Refactored audience data handling to include status and invite management. - Improved overall user experience with pagination and selection features in the audience table.
28 lines
779 B
TypeScript
28 lines
779 B
TypeScript
import { createAuthMiddleware } from 'better-auth/api';
|
|
|
|
export type AuthMiddlewareContext = Parameters<Parameters<typeof createAuthMiddleware>[0]>[0];
|
|
|
|
/**
|
|
* Array of all hooks to run after better-auth requests
|
|
*
|
|
* Add new hooks here to register them
|
|
*/
|
|
const afterHooks: Array<(context: AuthMiddlewareContext) => Promise<unknown>> = [
|
|
// add hooks here
|
|
];
|
|
|
|
/**
|
|
* Combines all after hooks into a single function
|
|
* This function will be called by better-auth after each request
|
|
*/
|
|
export const combineAfterHooks = async (context: AuthMiddlewareContext) => {
|
|
console.log('[auth] combineAfterHooks: running');
|
|
for (const hook of afterHooks) {
|
|
try {
|
|
await hook(context);
|
|
} catch (error) {
|
|
console.error('Error executing hook:', error);
|
|
}
|
|
}
|
|
};
|