better-auth-dashboard
Version:
A better-Auth powered admin dashboard.
15 lines (14 loc) • 436 B
JavaScript
export const dashboardMiddleware = (auth, callback) => {
return async (request) => {
const { data, error } = await auth.getSession({ fetchOptions: { headers: request.headers } });
if (error) {
console.error(error);
throw error;
}
console.log(data);
return await callback(request);
};
};
export const dashboardMatcher = () => {
return [`/dashboard/:path*`];
};