- Updated next-auth dependency in package.json to version 5.0.0-beta.29. - Refactored create-admin script to use a valid email format. - Implemented authentication middleware for various API routes to enforce access control. - Refactored API route handlers to improve readability and maintainability. - Enhanced error handling in authentication error page. - Added detailed tests for authentication flow, including protected routes and NextAuth endpoints.
13 lines
418 B
JavaScript
13 lines
418 B
JavaScript
import { getAllTaskTemplates } from "@/lib/queries/tasks";
|
|
import { NextResponse } from "next/server";
|
|
import { withReadAuth } from "@/lib/middleware/auth";
|
|
|
|
// GET: Get all task templates
|
|
async function getTaskTemplatesHandler() {
|
|
const templates = getAllTaskTemplates();
|
|
return NextResponse.json(templates);
|
|
}
|
|
|
|
// Protected routes - require authentication
|
|
export const GET = withReadAuth(getTaskTemplatesHandler);
|